Php 获取错误的MySQL数据
我有一个表,它有一个列test_id,我需要获取的数据不等于t-0105、t-0120、t-044、t-063、t-064、t-068、t-072,而是查询获取所有数据Php 获取错误的MySQL数据,php,mysql,Php,Mysql,我有一个表,它有一个列test_id,我需要获取的数据不等于t-0105、t-0120、t-044、t-063、t-064、t-068、t-072,而是查询获取所有数据 select * from test_name where test_type='p' and test_id NOT IN ('t-0105,t-0120,t-044,t-063,t-064,t-068,t-072') and test_list='tt' and test_name like '%aptitude%' and
select * from test_name where test_type='p' and test_id NOT IN ('t-0105,t-0120,t-044,t-063,t-064,t-068,t-072') and test_list='tt' and test_name like '%aptitude%' and published=1 order by id asc
您将单引号
“
放错了。在查询中,中的条件将所有值作为单个字符串。您应该添加它,如下所示
select * from test_name where test_type='p' and test_id NOT IN ('t-0105','t-0120','t-044','t-063','t-064','t-068','t-072') and test_list='tt' and test_name like '%aptitude%' and published=1 order by id asc
在中的每个字符串上添加引号,而不是在整个中添加引号