1

hope someone can help me to understand why this first query works while the second one does not. My goal is to show first the row with status "close" and then the row with status "wait"

 "SELECT *  from job WHERE status='close' AND status='wait' ";

 "SELECT *  from job WHERE status='close ";

I attempted to do this which is working but i want to show all status except "deleted"

$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

2 Answers 2

1

Use where condition with status<>'deleted'

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')
Sign up to request clarification or add additional context in comments.

1 Comment

This is working, thank you. I was able to sort the Status as i liked but could not omit one of them.
0

There is a missing single quote after 'close. Also, try using status!='deleted' or status<>'deleted'.

2 Comments

I don't see that missing quote that you mention.
Missing quote is my error in the post, that is actually working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.