List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:February 25 2005 12:19am
Subject:How can I find the records that are NOT IN the list
View as plain text  
I have an "IN()" list of 107 IDs (PK) out of about 6000 possible.

I do this query and I get 105 rows back. 

I want to know which two [107 - 105 = 2] of the IDs in the "IN()" list are
absent?

# 105 rows 
SELECT count(*)
FROM mytable  
WHERE id IN (11704, 10144, 11842, 11299, 11192, 11563, 11378, 10343, 10752,
10626, 11916, 11456, 11813, 11337, 10219, 11356, 11800, 10243, 10251, 11357,
11353, 11267, 12110, 200044, 11875, 11060, 10233, 10865, 10264, 10857,
10659, 10266, 10987, 11317, 11868, 10858, 11087, 11088, 10260, 11321, 11350,
10247, 10258, 10248, 11232, 10588, 11086, 11828, 10055, 11347, 10278, 11349,
10261, 11499, 11351, 11316, 12284, 12240, 12265, 11340, 10708, 11041, 11853,
12255, 11507, 11788, 10067, 10888, 11875, 11333, 10867, 10938, 11030, 10654,
10538, 10918, 11068, 11237, 11060, 10127, 10495, 10035, 10294, 10173, 10098,
10282, 10383, 10049, 10076, 10277, 10106, 10541, 10176, 10131, 10252, 11051,
11152, 11932, 11318, 10886, 10605, 10029, 11857, 10549, 10329, 11510,
10539);


Thread
How can I find the records that are NOT IN the listDaevid Vincent25 Feb
  • Is there something broken with IN()? WAS: How can I find the records that are NOT IN the listDaevid Vincent25 Feb
    • RE: Is there something broken with IN()? -- SOLVEDDaevid Vincent25 Feb