I have query with a where clause like
SELECT
name
FROM
adresses
WHERE
(name ='Peter' AND
surname = 'Miller') OR
emailadress1 = '[email protected]' OR
emailadress2 = '[email protected]'
Example Table
name surname emailadress1 emailadress2
------------------------------------------------
Michael [email protected]
Jim [email protected]
Peter Miller
Resulting in:
Michael
Jim
Peter
Now it seams that the records are sorted as the come in, just like the sort order of the example table above.
But I want to get them in a list where they folow by the where clause order itself. Like
name & surname = sortorder 1
emailadress1 = sortorder 2
emailsadress2 = sortorder 3
Example
Peter
Michael
Jim
If you are looking to sort them by reverse alphabetical then you would add ORDER BY name DESC to the end of your query.
If you are looking to sort your results by specific people then you would have to add some sort of identifier or ranking to them and then sort by that.