开发者

search canadian province

开发者 https://www.devze.com 2022-12-14 12:48 出处:网络
I have an input search on the site and I want to search in the database (MySQL) after province name. In database I have just the provinces initials - ex: QC for Quebec, AB - Alberta, etc.

I have an input search on the site and I want to search in the database (MySQL) after province name.

In database I have just the provinces initials - ex: QC for Quebec, AB - Alberta, etc.

The people can introduce into the input search field: QC or PC or Province du Québec or Pr开发者_如何学JAVAovince Quebec or Quebec or Québec (capital letters or not) (of course - this is just for one of the province, but are more :) )

What kind of SQL statment I can use or how can I solve my problem?

Thanks


You need an alias table where you can define all the synonyms for a given province (ie. alias). Each alias would have a FK to the province it belongs. You can then do your search against the alias table and do a join to your province table to find whatever province.

0

精彩评论

暂无评论...
验证码 换一张
取 消