Select only unique row/record in mysql

后端 未结 4 476
我在风中等你
我在风中等你 2021-01-12 21:47

I would like to see how I can get only unique row/records that have a unique city and not care if it\'s capital so for example:

Akron
akron
aKRON

4条回答
  •  走了就别回头了
    2021-01-12 22:31

    You can us a function in a GROUP BY to convert all names to upper or lowercase:

     SELECT  city,state_prefix,lattitude,longitude 
            FROM zip_code WHERE city LIKE '$queryString%'
            GROUP BY UPPER(city), UPPER(state_prefix) LIMIT 10
    

    I'm assuming if a city and state match, lattitude and longitude can be safely rolled up.

提交回复
热议问题