MySQL some columns Distinct
- by Adam
I have the following query that works well.
SELECT DISTINCT city,region1,region2 from static_geo_world where country='AU' AND
(city LIKE '%geel%' OR region1 LIKE '%geel%' OR region2 LIKE '%geel%' OR region3 LIKE '%geel%' OR zip LIKE 'geel%') ORDER BY city;
I need to also extract a column named 'id' but this messes up the DISTINCT as each ID is different.
How can I get the same UNIQUE set of records as above but also get the 'id' for each record?
Note: sometimes I can return a few thousand records so a query for each record isn't possible.
Any ideas would be very welcome...