Complex Query?

Results 1 to 2 of 2

Thread: Complex Query?

  1. #1
    Join Date
    Dec 1969

    Default Complex Query?

    I have 2 tables, say table1, and table2. There is a DocID (primary key) in table1. In table2, DocID is the foriegn key. There can be more than 1 DocID. <BR><BR>this is the table structure (sample) <BR><BR>Table 1: <BR>DocID DocName OtherID etc <BR>1 test 2 <BR>2 test2 3 <BR><BR>Table2: <BR>TblID DocID OtherID <BR>1 1 10 <BR>2 1 13 <BR>3 1 25 <BR><BR>how do I join these two tables, such that I get all the otherID&#039;s for each DocID. <BR>ie., <BR>DocID OtherID <BR>1 2 and 10 and 13 and 25 <BR>2 3 <BR><BR>i am writing this query to display search results on a search page (with keyword search) and so, if I display the result in more than one row, then the user might think that there is more than document...whereas the case is that there is only one document with more than one other ID&#039;s. <BR><BR>is there any way I can do this? display...more than 1otherID in the same row for the same DociD? <BR>Currently, I am using a left outer join of table1 and table2.<BR><BR>An suggestions on how to do this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Complex Query?

    The easiest way is to do check if the DocID is the same in your ASP code rather than try getting the DB to run through hoops!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts