希望有人可以帮助我理解为什么第一个查询有效而第二个查询无效。 我的目标是首先显示状态为“关闭”的行,然后显示状态为“等待”的行
"SELECT * from job WHERE status='close' AND status='wait' ";
"SELECT * from job WHERE status='close ";
我尝试执行此操作,但是我想显示除“已删除”之外的所有状态
$sql = "SELECT id,date, device,model,problem,status,assigned from job ORDER BY FIELD(status,'deler_trenger','deler_bestilt','new','progress','wait','done','close','cancel')";
答案 0 :(得分:1)
在status<>'deleted'
处使用where条件
SELECT id,date, device,model,problem,status,assigned from job
where status<>'deleted'
ORDER BY FIELD(status,'deler_trenger','deler_bestilt','new','progress','wait','done','close','cancel')
答案 1 :(得分:0)
'close
后缺少单引号。另外,请尝试使用status!='deleted'
或status<>'deleted'
。