我有一个数据库,如下所示:

        name                ||        Country       ||   code
     Los Angeles                   United States          LAX
***Additional Services***         United Kingdom          999V
     New York                      United States          NYC


我想在与术语匹配的三列中选择所有值,但隐藏以“ *”开头的那些值。这是我的SQL从三列中选择任何值,我只需要添加部分以跳过以*开头的值即可。

SELECT code, name, Country FROM city_codes WHERE CONCAT(code, name, Country) LIKE '%$term%' ORDER BY name ASC

最佳答案

添加到where子句

and name not like '*%'

10-07 19:34
查看更多