|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Very similar to selecting only those values in table1 that exist in table2 also, I want to select all those that exist in table1 but NOT in table 2.
I have no clue how to do this. I tried: select table1.ID from table1, table2 where table1.ID <> table2.ID but that does not work because it simply returns the rows in the reversed order. select table1.ID from table1, table2 where table1.ID = table2.ID works for the opposite effect. (finding all rows where the value is same in the first and second table) |
|
#2
|
|||
|
|||
|
You won't be able to do it in one query (until MySQL supports sub-selects).
|
|
#3
|
|||
|
|||
|
The answer posted here is incorrect - this is a standard LEFT JOIN query. see the other thread with this same topic at http://www.devshed.com/Talk/Forums/Forum5/HTML/003301.html
|
|
#4
|
|||
|
|||
|
I shouldn't answer posts before I've had my morning coffee....
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Select ID from table1 where ID not in table2 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|