SELECT Table1.Field1
>FROM Table1
> INNER JOIN Table2
> ON Table1.PK1 = Table2.FK2
>WHERE Table2.Field2 = value1
SELECT Table1.Field1
>FROM Table1
> INNER JOIN
> (SELECT Table2.Field2, Table2.FK1
> FROM Table2
> WHERE Table2.Field2 = value1)
> ON Table1.PK1 = Table2.FK1
SELECT Table1.Field1
>FROM Table1
>WHERE Table1.PK1 IN
> (SELECT Table2.FK1
> FROM Table2
> WHERE Table2.Field2 = value1)
SELECT Table1.Field1 FROM Table1 WHERE EXISTS (SELECT * FROM Table2 WHERE Table1.PK1 = Table2.FK2 AND Table2.Field2 = value1)>The type of query that I am having the most trouble with is when I want to select the rows in a table that don't have their primary keys listed as a foreign key in a table with which it has a 0..* relationship. I have been coding it as,
SELECT Table1.Field1
>FROM Table1
> LEFT OUTER JOIN Table2
> ON Table1.PK1 = Table2.PK2
>WHERE Table2.FK1 IS NULL
SELECT Table1.Field1 FROM Table1 WHERE NOT EXISTS (SELECT * FROM Table2 WHERE Table1.PK1 = Table2.FK2)