Results 1 to 3 of 3

Thread: Joins

  1. #1
    Join Date
    Dec 1969

    Default Joins

    Table 1<BR>Columns: contactID, firstname, lastname <BR><BR>Table 2<BR>Columns: Project, ContactIDA, ContactIDB, Description<BR>where ContactIDA and ContactIDB refer to rows in table 1<BR><BR>How can i join these two tables together on contactID=ContactIDA and contactID=ContactIDB? <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Same as any other join (eop)


  3. #3
    Join Date
    Dec 1969

    Default RE: Joins

    Does all projects have 2 contacts?<BR><BR>If some projects only have one contact you need an outer join, if not change the second join to an inner join<BR><BR>select c1.firstName,c1.lastName, project, c2.firstName,c2.lastName<BR> from table1 c1 inner join table2 t2<BR> on c1.contactId = t2.ContactIDA <BR> left outer join table1 c2<BR> on t2.contactIDB = c2.contactID

Posting Permissions

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