1,我要通过 输入“电脑” 得到有“电脑”二字的所有行
2,通过 输入“电脑” 只得到“电脑”二字精确匹配的所有行
请问该怎么样设置查询时的参数?只在where处限制就可以了吗?谢谢!
---------------------------------------------------------------
1.sql="select * from 数据表 where 字段名 like '%字段值%'"
2.sql="select * from 数据表 where 字段名='字段值'"
---------------------------------------------------------------
模糊:"select * from [] where subject like '%电脑%'"
精确:"select * from [] where subject='电脑'"
---------------------------------------------------------------
1: select * from table where type like '%电脑%'
2: select * from table where type = '电脑'
---------------------------------------------------------------
楼上几位都说完了
反正是用=和like来分别做精确和模糊查询
---------------------------------------------------------------
sql="select * from TABLE where 字段名 like '%" & 所要查询的变量 &"%'"
---------------------------------------------------------------
用=和like来分别做精确和模糊查询,答案已经很清楚了吧。
---------------------------------------------------------------
模糊select * from table where field like '%"&关键字 &"%'"
正确select * from table where field = '%"&关键字 &"%'"