oracle数据查询的问题。

chineseyounger 2009-10-16 12:26:24
oracle数据库两张表:
a表地址表
id addressname
1 北京
2 上海
3 武汉
4 重庆
5 南京
6 天津
7 广州
b表2个字段
id addresslist
1 2,3
2 5,6
输出结果要求a表中除了2,3,5,6以外的id信息。注意:条件根据b表中的addresslist得到的。
谢谢大家!很急!


...全文
86 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
inthirties 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wildwave 的回复:]
select * from a
where not exists(
  select 1 from b where instr(','||addresslist||',',','||a.id||',')>0)
[/Quote]

赞一个
IT农夫 2009-10-21
  • 打赏
  • 举报
回复
select * from a
where not exists(
select 1 from b where instr(addresslist,a.id)>0)
同意2楼
小灰狼W 2009-10-16
  • 打赏
  • 举报
回复
select * from a
where not exists(
select 1 from b where instr(','||addresslist||',',','||a.id||',')>0)

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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