字段中有分号的查询语句如何写

terencegan 2007-01-03 01:15:23
请问,表person的id字段保存内容中用分号间隔多个数据,为"123;234;345"。
select * from person where id .....
id对应的变量为123,是id的内容中的一个部分。
查询语句该如何写呢?
...全文
197 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangyangxie 2007-01-03
  • 打赏
  • 举报
回复
楼上的都是答案,呵呵
baoshan 2007-01-03
  • 打赏
  • 举报
回复
select * from person where charindex('123',id)>0
marco08 2007-01-03
  • 打赏
  • 举报
回复
--try
select * from person where charindex('123', id)>0
or
select * from person where id like '%123%'
caixia615 2007-01-03
  • 打赏
  • 举报
回复
select * from person where id like '%123%'
baoshan 2007-01-03
  • 打赏
  • 举报
回复
select * from person where charindex(id ,'123')>0

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧