nerhael
07-11-2003, 04:13 PM
Two tables.
table1, table2
Table 1 contains all unique items.
Table 2 contains x references to table 1, unique by customerId
I want to do a join onto table2 where table1.id = table2.table1Id AND table2.customerId = the user's ID
I can't quite figure out how to work in the idea of an AND into my left join. Unless both those conditions are two, I don't want any data from table2.
Only solution I can think of so far is to just left join on the id's, but select the customerId from table2, and as I loop through, check to see if it's supplied and the right id, and keep track of duplicate items from multiple customers myself.
Suggestions?
Pete.
table1, table2
Table 1 contains all unique items.
Table 2 contains x references to table 1, unique by customerId
I want to do a join onto table2 where table1.id = table2.table1Id AND table2.customerId = the user's ID
I can't quite figure out how to work in the idea of an AND into my left join. Unless both those conditions are two, I don't want any data from table2.
Only solution I can think of so far is to just left join on the id's, but select the customerId from table2, and as I loop through, check to see if it's supplied and the right id, and keep track of duplicate items from multiple customers myself.
Suggestions?
Pete.