![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How come this one works SELECT DISTINCT a.d FROM a,b WHERE a.c NOT IN (SELECT b.c FROM b) but this one doesn't * * * * * * * * SELECT DISTINCT a.d,a.c * * * * * * * * FROM a * * * * * * * * LEFT JOIN b USING (c) WHERE a.c<>b.c I'm trying to get the rows in a.c that don't match b.c but the 2nd one should be faster. thanks, Janis TABLE A * * * * * * * TABLE B col d * col c * * * * * *col c ____________ * * * ____________ 1 * * *apple * * * *apple 2 * * *banana * * * * kiwi 3 * * *orange * * * * banana 4 * * *grapefruit * * blackberry 5 * * *cherry * * * * persimmon 6 * * NULL * * * * * * * *apple thanks, |
#3
| |||
| |||
|
|
Please disregard, I have it. |
#4
| |||
| |||
|
|
TABLE A TABLE B col d col c col c ____________ ____________ 1 apple apple 2 banana kiwi 3 orange banana 4 grapefruit blackberry 5 cherry persimmon 6 NULL apple thanks, Please disregard, I have it. SELECT DISTINCT a.d, a.c FROM a INNER JOIN b ON a.c <> b.c WHERE a.c NOT IN ( SELECT b.c FROM b ) LIMIT 0 , 30 |
![]() |
| Thread Tools | |
| Display Modes | |
| |