PDA

View Full Version : Left Join Conditions


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.

nerhael
07-11-2003, 04:41 PM
IGNORE

Heh, go figure, AND actually works. Yet I don't think I saw a single use of it in all of the documentation with JOINs....

I feel like an idiot. Sorry for having wasted anyone's time.

Blarg.