免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1497 | 回复: 1

求一个mysql 语句 [复制链接]

论坛徽章:
0
发表于 2014-08-13 15:26 |显示全部楼层
select count(distinct account) from temp.loginacc_140812 a
where not exists
(select distinct account from
(select account from temp.loginacc_140801
union all
select  account from temp.loginacc_140802
union all
select  account from temp.loginacc_140803
union all
select  account from temp.loginacc_140804
union all
select  account from temp.loginacc_140805
union all
select  account from temp.loginacc_140806
union all
select  account from temp.loginacc_140807
union all
select  account from temp.loginacc_140808
union all
select  account from temp.loginacc_140809
union all
select  account from temp.loginacc_140810
union all
select  account from temp.loginacc_140811) b
where a.account=b.account)

一个今天生成的表要和之前历史的做比较,这越来越长不是个办法,有什么简单的写法吗?

论坛徽章:
93
2015年辞旧岁徽章
日期:2019-10-10 10:51:15CU大牛徽章
日期:2014-02-21 14:21:56CU十二周年纪念徽章
日期:2020-10-15 16:55:55CU大牛徽章
日期:2014-02-21 14:22:07羊年新春福章
日期:2019-10-10 10:51:39CU大牛徽章
日期:2019-10-10 10:55:38季节之章:春
日期:2020-10-15 16:57:40ChinaUnix元老
日期:2019-10-10 10:54:42季节之章:冬
日期:2019-10-10 10:57:17CU大牛徽章
日期:2014-02-21 14:22:52CU大牛徽章
日期:2014-03-13 10:40:30CU大牛徽章
日期:2014-02-21 14:23:15
发表于 2014-08-13 16:50 |显示全部楼层
没啥想法,考虑脚本或是动态sql?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP