Mysql
 sql >> база данни >  >> RDS >> Mysql

Проверете кои идентификатори от набор не съществуват в таблица

Не познавах функцията find_in_set() и използвах по-ръчно изработен подход. Не че има някакъв смисъл предвид първия отговор, но все пак ще го публикувам:

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. Не може да се осъществи връзка, защото целевата машина активно я отказа (PHP / WAMP)

  2. MySQL SELECT DISTINCT трябва да е чувствителен към малки и големи букви?

  3. свържете се с локален MySQL сървър чрез сокет

  4. Вмъкване на няколко реда с PDO

  5. MySQL:Получавате средна стойност на разликите във времето?