Friday, 30 August 2013

How to get the records according to the where clauses in Mysql?

How to get the records according to the where clauses in Mysql?

I have been facing a small confusion from which I am not able to get rid.
I have a table "user_questions" with the attributes id,
question_sequence_number, title. From that table I want to take the
records according to the priority given like first I have given
'question_sequence_number' and then 'id'. So what I want is that the
records should be displayed first with the sequence numbers I have given
and the records should be displayed next with Ids I have given.
For that I have written a mySql query something like follows:

SELECT "user_questions".* FROM "user_questions" WHERE
(question_sequence_number IN (11,13,16,19) OR id IN (198,199,200,201,202))
But the records are coming first with ids I have given and the remaining
records with question sequence number.
Can anybody please help me out in this to achieve ?
Thanks.

No comments:

Post a Comment