Given the query:
select *
from clients
WHERE (post=4555) OR (post=4074) OR (post=4064)
Is there any way to order this by what I have specified in the 'OR' clause? i.e. I want this to return:
xxx POST
... 4555
... 4074
... 4064
I am doing a proximity based search (calculating distances between postcodes using latitudes and longitudes) using PHP and want to order this by proximity.
Given that my query can return up 1000 postcodes, I have three options here:
1. Do a separate query for each post code (* yuck *)
2. Do a table sort in HTML page on the proximity column after outputting my results (* better *)
3. Somehow get MySQL to output the results in the order of the fields in the 'OR' clause. (* best *)
Thanks.
------------------------------------
There's no place like 127.0.0.1
------------------------------------
select *
from clients
WHERE (post=4555) OR (post=4074) OR (post=4064)
Is there any way to order this by what I have specified in the 'OR' clause? i.e. I want this to return:
xxx POST
... 4555
... 4074
... 4064
I am doing a proximity based search (calculating distances between postcodes using latitudes and longitudes) using PHP and want to order this by proximity.
Given that my query can return up 1000 postcodes, I have three options here:
1. Do a separate query for each post code (* yuck *)
2. Do a table sort in HTML page on the proximity column after outputting my results (* better *)
3. Somehow get MySQL to output the results in the order of the fields in the 'OR' clause. (* best *)
Thanks.
------------------------------------
There's no place like 127.0.0.1
------------------------------------