Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Periksa ID mana dari set yang tidak ada di tabel

Saya tidak tahu fungsi find_in_set() dan mengambil pendekatan yang lebih buatan tangan. Bukannya masuk akal jika diberikan jawaban pertama, tetapi saya akan tetap mempostingnya:

SELECT id
FROM (
    SELECT '757392' AS id UNION
    SELECT '733602' UNION
    SELECT '749955' UNION
    SELECT '744304' UNION
    SELECT '746852' UNION
    SELECT '753904' UNION
    SELECT '755117' UNION
    SELECT '636163' UNION
    SELECT '564931' UNION
    SELECT '740787' UNION
    SELECT '751450' UNION
    SELECT '743799' UNION
    SELECT '643918' UNION
    SELECT '749903' UNION
    SELECT '571888' UNION
    SELECT '30207'  UNION   
    SELECT '705953' UNION
    SELECT '749120' UNION
    SELECT '749001' UNION
    SELECT '749192' UNION
    SELECT '749978' UNION
    SELECT '750840' UNION
    SELECT '544228' UNION
    SELECT '702121' UNION
    SELECT '746246' UNION
    SELECT '383667' UNION
    SELECT '558790' UNION
    SELECT '585628' UNION
    SELECT '592771' UNION
    SELECT '745818' UNION
    SELECT '749375' UNION
    SELECT '241209' UNION
    SELECT '749235' UNION
    SELECT '746860' UNION
    SELECT '748318' UNION
    SELECT '748016' UNION
    SELECT '748951' UNION
    SELECT '747321' UNION
    SELECT '748684' UNION
    SELECT '748225' UNION
    SELECT '565375' UNION
    SELECT '748673' UNION
    SELECT '747869' UNION
    SELECT '748522' UNION
    SELECT '748335' UNION
    SELECT '744775' UNION
    SELECT '672229' UNION
    SELECT '578056' UNION
    SELECT '713127' UNION
    SELECT '740234' UNION
    SELECT '632608' UNION
    SELECT '711135' UNION
    SELECT '746528' UNION
    SELECT '362131' UNION
    SELECT '742223' UNION
    SELECT '746567' UNION
    SELECT '745224' UNION
    SELECT '332989' UNION
    SELECT '439837' UNION
    SELECT '745418' UNION
    SELECT '673582' UNION
    SELECT '269584' UNION
    SELECT '742606' UNION
    SELECT '745135' UNION
    SELECT '746950' UNION
    SELECT '476134' UNION
    SELECT '740830' UNION
    SELECT '742949' UNION
    SELECT '276934') AS id_list
WHERE id NOT IN (
    SELECT id
    FROM users);


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Cara Memaksa UPDATE Catatan MySQL Saat Tidak Ada yang Berubah

  2. Membership.Provider untuk mysql di masalah asp.net

  3. PDO dengan MySQL tidak berfungsi dalam aktivasi email

  4. Prosedur Tersimpan vs Pemicu di MySQL

  5. Pencocokan seluruh kata dengan karakter titik di MySQL