数据库的问题,在线等;

wuzhentian 2011-12-16 04:12:29
selcet target from r_c_e_h20111205 t where call_type='1' not in (selcet call_number from d_areacfg);
请问下这句话有什么错误。这句话就是说在r_c里面找在d_里面没有的数据;
...全文
77 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
woshiliushanj 2011-12-16
  • 打赏
  • 举报
回复
这种问题 最好自己能看出来 浪费分数
huangdh12 2011-12-16
  • 打赏
  • 举报
回复
and not in 需要指定什么内容 not in啊
A洛 2011-12-16
  • 打赏
  • 举报
回复
正解[Quote=引用 3 楼 lxpbs8851 的回复:]
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
[/Quote]
xiaobn_cn 2011-12-16
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yixilan 的回复:]
引用 3 楼 lxpbs8851 的回复:
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);

3楼的也对。
如果用not in,前面就必须加上字段名;
如果用not exists,前面不用加字段名、
[/Quote]

偶感觉关键是楼主少了个字段名,就是用哪个字段的值与d_areacfg中比较呢。如果按1楼的写法是不符合楼主需求的,合用exists也需要加上where条件才对。
yixilan 2011-12-16
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 lxpbs8851 的回复:]
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
[/Quote]
3楼的也对。
如果用not in,前面就必须加上字段名;
如果用not exists,前面不用加字段名、
oO寒枫Oo 2011-12-16
  • 打赏
  • 举报
回复

where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
yixilan 2011-12-16
  • 打赏
  • 举报
回复
少了and,并且改用exists
selcet target from r_c_e_h20111205 t 
where call_type='1' and not exists (selcet call_number from d_areacfg);

17,378

社区成员

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

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