I think I'm getting stupid or something, not sure why I cannot solve this! *lol*
I got two tables TABLE1 and TABLE2. TABLE1 has some item ids which can have one or more linked values from TABLE2.
Example:
TABLE1.ID
TABLE1.ITEMID
TABLE1.table2_ID
TABLE2.ID
TABLE2.DESCRIPTION
Data sample:
TABLE1:
ID ---- ITEMID ---- table2_ID
1 ---- SOMEITEMa ---- 2
2 ---- SOMEITEMa ---- 3
3 ---- SOMEITEMa ---- 4
4 ---- SOMEITEMb ---- 2
5 ---- SOMEITEMc ---- 2
TABLE2:
ID ---- DESCRIPTION
1 ---- somedescription001
2 ---- somedescription002
3 ---- somedescription003
4 ---- somedescriptoin004
As you see, in TABLE1, I got 3 items "SOMEITEMa","SOMEITEMb","SOMEITEMc" which all share "description002" connected by TABLE2.ID to them.
My question is: How do I select from TABLE1 only those ITEMIDs which have TABLE2.ID='2' and NO OTHER IDs connected to them? I basically want the result to show two rows from TABLE1, which is "SOMEITEMb" and "SOMEITEMc", and not "SOMEITEMa" because that item has other values connected to it. Eventhough is has TABLE2.ID='2' connected to it, I don't want to select it because it has other IDs from TABLE2 as well.
Thanks!



Help

Back to top









