简体   繁体   中英

Unable to search the records using keyword but the keyword is exists in table in MySQL

I have city table with structure as -

#   Name         Type           Collation
1   cityId       int(11)            
2   countryCode  char(5)        latin1_swedish_ci
3   cityName     varchar(100)   utf8mb4_unicode_ci
4   lat          varchar(20)    latin1_swedish_ci
5   lng          varchar(20)    latin1_swedish_ci

I have cities for 'countryCode' - 'ad' like -

cityId countryCode cityName   lat        lng
1      ad          Aixàs      42.4833333 1.4666667
2      ad          Aixirivali 42.4666667 1.5
3      ad          Aixirivall 42.4666667 1.5
4      ad          Aixirvall  42.4666667 1.5
5      ad          Aixovall   42.4666667 1.4833333

But when i execute a query - SELECT * FROM city WHERE countryCode = 'ad' , I get empty data. I imported this data from excel sheet having almost 32,00,000 records. I have checked that there is no space before or after the country code. Is there any issue with the collation ? Do i need to do some some conversion ? Please help.

尝试对要搜索的文本进行整理:

  SELECT * FROM city WHERE countryCode = 'ad' COLLATE latin1_swedish_ci

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM