Using wildcard in table data

不羁岁月 提交于 2019-12-13 09:52:44

问题


Using MYSQL I have a table where the data has wildcards. Example...

|ID  | Model  |
|1   | dv209% | 

I'm tryinh to write a sql query that will find row 1 when model='dv209AWW' or model='dv209asdfs'.

Any help would be appreciated.


回答1:


use LIKE

select id, model
from your_table
where 'dv209AWW' like model
order by id 



回答2:


Try this:

SELECT Id, Model
FROM yourTable
where model LIKE 'dv209%'

So it will find the row when the value is dv209AWW or dv209asdfs



来源:https://stackoverflow.com/questions/15689624/using-wildcard-in-table-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!