如何判断一个字段的值是否包含在某个字符串中??

twtetgso 2010-12-13 01:45:29
表中有一个字段meetingdate,如何来检索出所有这个表中meetingdate字段包含在一个字符串中的数据。
如:meetingdate如下
Aug1
Sep3
Aug2
Nov6
Set9


检索出上面值包含在字符串"Set3,Nov6,Aug2"中的数据
...全文
767 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxyzxq2008 2010-12-13
  • 打赏
  • 举报
回复
instr('xxxxx',字段)
jjm 2010-12-13
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wonderjjm 的回复:]
试一下:
where 'Set3,Nov6,Aug2' like meetingdate || '%'
[/Quote]

少了一块。。。
where 'Set3,Nov6,Aug2' like '%' || meetingdate || '%'
jjm 2010-12-13
  • 打赏
  • 举报
回复
试一下:
where 'Set3,Nov6,Aug2' like meetingdate || '%'
心中的彩虹 2010-12-13
  • 打赏
  • 举报
回复
[Quote=引用楼主 twtetgso 的回复:]
表中有一个字段meetingdate,如何来检索出所有这个表中meetingdate字段包含在一个字符串中的数据。
如:meetingdate如下
Aug1
Sep3
Aug2
Nov6
Set9


检索出上面值包含在字符串"Set3,Nov6,Aug2"中的数据
[/Quote]





select * from tb where instr('Set3,Nov6,Aug2',meetingdate)>0


  • 打赏
  • 举报
回复
[Quote=引用楼主 twtetgso 的回复:]
表中有一个字段meetingdate,如何来检索出所有这个表中meetingdate字段包含在一个字符串中的数据。
如:meetingdate如下
Aug1
Sep3
Aug2
Nov6
Set9


检索出上面值包含在字符串"Set3,Nov6,Aug2"中的数据
[/Quote]

scott@YPCOST> ed
已写入 file afiedt.buf

1 with tb as(
2 select 'Aug1' meetingdate from dual union all
3 select 'Sep3' from dual union all
4 select 'Aug2' from dual union all
5 select 'Nov6' from dual union all
6 select 'Set9' from dual)
7* select * from tb where instr('Set3,Nov6,Aug2',meetingdate)>0
scott@YPCOST> /

MEET
----
Aug2
Nov6

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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