T
tig
I've got two tables. I need to see all the records in table1 and some
fields from table2 based on conditions. My primary join field (field1)
could give me duplicate records in table2. So what I need is, if
table2 has two records matching table1 on field1, only give me the
table2 record where field2 = X. Don't show me the other one. If only
one table2 record matches on field1, then give me that one.
I'm a little green on SQL. So any help would be greatly appreciated.
Here's my code so far, I'm just not sure how to continue.
SELECT Table1.Field1, Table1.Dt, Table1.Field3, Table2.Field1,
Table2.field2
FROM Table1 LEFT JOIN Table2 ON Table1.Field1 = Table1.Field1
WHERE (((Table1.Field2)="Yes") AND ((Table1.Dt)=Date()));
Thanks in advance.
fields from table2 based on conditions. My primary join field (field1)
could give me duplicate records in table2. So what I need is, if
table2 has two records matching table1 on field1, only give me the
table2 record where field2 = X. Don't show me the other one. If only
one table2 record matches on field1, then give me that one.
I'm a little green on SQL. So any help would be greatly appreciated.
Here's my code so far, I'm just not sure how to continue.
SELECT Table1.Field1, Table1.Dt, Table1.Field3, Table2.Field1,
Table2.field2
FROM Table1 LEFT JOIN Table2 ON Table1.Field1 = Table1.Field1
WHERE (((Table1.Field2)="Yes") AND ((Table1.Dt)=Date()));
Thanks in advance.