数据库的问题,在线等;
时间:2011-12-16
来源:互联网
selcet target from r_c_e_h20111205 t where call_type='1' not in (selcet call_number from d_areacfg);
请问下这句话有什么错误。这句话就是说在r_c里面找在d_里面没有的数据;
请问下这句话有什么错误。这句话就是说在r_c里面找在d_里面没有的数据;
作者: wuzhentian 发布时间: 2011-12-16
少了and,并且改用exists
SQL code
SQL code
selcet target from r_c_e_h20111205 t where call_type='1' and not exists (selcet call_number from d_areacfg);
作者: yixilan 发布时间: 2011-12-16
该回复于2011-12-16 16:31:22被管理员删除
- 对我有用[0]
- 丢个板砖[0]
- 引用
- 举报
- 管理
- TOP
|
#3楼 得分:0回复于:2011-12-16 16:26:37
|
作者: hfhf111 发布时间: 2011-12-16
引用 3 楼 lxpbs8851 的回复:
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
3楼的也对。
如果用not in,前面就必须加上字段名;
如果用not exists,前面不用加字段名、
作者: lxpbs8851 发布时间: 2011-12-16
引用 4 楼 yixilan 的回复:
引用 3 楼 lxpbs8851 的回复:
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
3楼的也对。
如果用not in,前面就必须加上字段名;
如果用not exists,前面不用加字段名、
引用 3 楼 lxpbs8851 的回复:
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
3楼的也对。
如果用not in,前面就必须加上字段名;
如果用not exists,前面不用加字段名、
偶感觉关键是楼主少了个字段名,就是用哪个字段的值与d_areacfg中比较呢。如果按1楼的写法是不符合楼主需求的,合用exists也需要加上where条件才对。
作者: yixilan 发布时间: 2011-12-16
正解
引用 3 楼 lxpbs8851 的回复:
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
where call_type='1' and xxxx not in (selcet call_number from d_areacfg);
作者: xiaobn_cn 发布时间: 2011-12-16
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28