-1

クエリを実行すると:

SELECT *
FROM   mag2
WHERE  environments_env_id LIKE '%test%'
        OR environments_env_id LIKE '%test%'
        OR environments_env_type LIKE '%test%'
        OR environments_host_label LIKE '%test%'
        OR environments_host_type LIKE '%test%'
        OR environments_local_id LIKE '%test%'
        OR samples_date_added LIKE '%test%'
        OR samples_description LIKE '%test%'
        OR samples_exec_arguments LIKE '%test%'
        OR samples_label LIKE '%test%'
        OR samples_owner LIKE '%test%'
        OR samples_sample_id LIKE '%test%'
        OR samples_sample_type LIKE '%test%'
        OR samples_source LIKE '%test%'
        OR task_state_state LIKE '%test%'
        OR task_state_state_id LIKE '%test%'
        OR tasks_env_id LIKE '%test%'
        OR tasks_env_return_code LIKE '%test%'
        OR tasks_env_runtime LIKE '%test%'
        OR tasks_env_start LIKE '%test%'
        OR tasks_exec_arguments LIKE '%test%'
        OR tasks_global_risk_score LIKE '%test%'
        OR tasks_owner_risk_score LIKE '%test%'
        OR tasks_sample_id LIKE '%test%'
        OR tasks_state_id LIKE '%test%'
        OR tasks_task_id LIKE '%test%'
        OR tasks_task_start LIKE '%test%'
        OR event LIKE '%test%' 

249 という結果が得られます。NOT IN を使用してクエリから 100 の結果を除外したいと考えています。これはデータベースの一意のインデックスであり、重複はありません。AND NOT IN を使用した私のステートメントは次のとおりです。

SELECT *
FROM   mag2
WHERE  environments_env_id LIKE '%test%'
        OR environments_env_id LIKE '%test%'
        OR environments_env_type LIKE '%test%'
        OR environments_host_label LIKE '%test%'
        OR environments_host_type LIKE '%test%'
        OR environments_local_id LIKE '%test%'
        OR samples_date_added LIKE '%test%'
        OR samples_description LIKE '%test%'
        OR samples_exec_arguments LIKE '%test%'
        OR samples_label LIKE '%test%'
        OR samples_owner LIKE '%test%'
        OR samples_sample_id LIKE '%test%'
        OR samples_sample_type LIKE '%test%'
        OR samples_source LIKE '%test%'
        OR task_state_state LIKE '%test%'
        OR task_state_state_id LIKE '%test%'
        OR tasks_env_id LIKE '%test%'
        OR tasks_env_return_code LIKE '%test%'
        OR tasks_env_runtime LIKE '%test%'
        OR tasks_env_start LIKE '%test%'
        OR tasks_exec_arguments LIKE '%test%'
        OR tasks_global_risk_score LIKE '%test%'
        OR tasks_owner_risk_score LIKE '%test%'
        OR tasks_sample_id LIKE '%test%'
        OR tasks_state_id LIKE '%test%'
        OR tasks_task_id LIKE '%test%'
        OR tasks_task_start LIKE '%test%'
        OR event LIKE '%test%'
           AND `tasks_task_id` NOT IN ( '1762', '1763', '1764', '1765',
                                        '1766', '1779', '1787', '1836',
                                        '1837', '1838', '1839', '1840',
                                        '1841', '1850', '1852', '1856',
                                        '1893', '1914', '1927', '1946',
                                        '1955', '1957', '1969', '1985',
                                        '1986', '2016', '2026', '2038',
                                        '2063', '2098', '2110', '2133',
                                        '2136', '2148', '5056', '5066',
                                        '5068', '5070', '5084', '5106',
                                        '5120', '5132', '5136', '5146',
                                        '5150', '5152', '539', '546',
                                        '547', '548', '549', '550',
                                        '551', '557', '563', '565',
                                        '587', '589', '590', '594',
                                        '602', '603', '621', '622',
                                        '623', '624', '625', '626',
                                        '627', '637', '640', '642',
                                        '643', '645', '646', '648',
                                        '650', '651', '656', '657',
                                        '658', '662', '663', '664',
                                        '665', '671', '672', '675',
                                        '676', '677', '687', '688',
                                        '691', '693', '695', '699',
                                        '701', '702', '756', '762' ) 

結果は 149 ではなく 150 になり、その理由がわかりません。AND != も試してみましたが、同じ結果が得られました。誰かが理由を説明してもらえますか?

4

3 に答える 3