求一条高效查询语句写法
时间:2011-11-13
来源:互联网
adshowlog
adid,ip,numiid,adtime,uid
adshowlog2
adid,ip,numiid,adtime,uid
想查询adshowlog2中的uid,查询条件是:adshowlog2中的ip、numiid不出现在adshowlog中
拜谢大虾
作者: yzy8788 发布时间: 2011-11-13
--uid和IP和numiid有一项不相同的 select * from adshowlog2 as a where not exists(select 1 from dshowlog where uid=a.uid and ip=a.ip and numiid=a.numiid) --uid存在,IP和numiid有一项不相同 select * from adshowlog2 as a where not exists(select 1 from dshowlog where uid=a.uid and ip=a.ip and numiid=a.numiid) and exists(select 1 from dshowlog where uid=a.uid)
作者: roy_88 发布时间: 2011-11-13
select a2.uip from adshowlog a, adshowlog2 a2 where a.ip <> a2.ip and a.numidd <> a2.numidd
你是不是这个意思
作者: ningweidong 发布时间: 2011-11-13
这两张表不管uid存不存在,其实只要查询出adshowlog2的记录,判断依据是adshowlog2中的ip、numiid不出现在adshowlog中就行
作者: yzy8788 发布时间: 2011-11-13
SQL code
select * from adshowlog2 as a where not exists(select 1 from dshowlog where ip=a.ip and numiid=a.numiid)
作者: roy_88 发布时间: 2011-11-13
大版的正解
作者: koumingjie 发布时间: 2011-11-13
select * from adshowlog2 as a where not exists(select 1 from dshowlog where ip=a.ip and numiid=a.numiid)
大阪正解
作者: public0011 发布时间: 2011-11-13
作者: pengxuan 发布时间: 2011-11-13
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28