数据库 SQL如何判断某一字段中是否包含多个值

来源:百度知道 编辑:UC知道 时间:2024/06/25 00:13:16
例如我要查询表table1的column列中是否包含(aa,bb,dd)这三个值,column列的值为(aa.bb.cc).
用SQL语句如何写才能使不属于column列的值dd被查找出来。
我想到用in,not in,不过没有成功,望高人指点。本人初学数据库
我是说结果是要找出dd,问题还不够清楚么?


select * from table1 where column in (aa,bb,dd)
这句只能找出aa,bb。我现在要想办法找出dd

select * from table1 where charindex('aa',column)>0 and charindex('bb',column)>0 and charindex('dd',column)>0

select * from table1 where column != dd//这个是column不为dd的数据
也可以这么写select * from table1 where column not in (dd)

select * from table1 where column in (aa,bb)//这个是column为aa或bb的数据

还有 你的问题很含糊 不知道一楼和我谁理解的对 问问题也要专业点嘛