开发者

search canadian province

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜