免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: learnscript
打印 上一主题 下一主题

一个MySQL query的问题 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2008-03-03 15:58 |只看该作者

回复 #10 sunnyfun 的帖子

想了个一个一个找的方法, 快了很多,

tee /var/tmp/my.list;
select a4.uid,(a4.timestamp-a1.timestamp) from
abclog_entries_20080301 a1,
(select a2.abclog_id, a2.timestamp, a3.uid from
abclog_entries_20080301 a2,
(select abclog_id,uid from
abclogs_20080301 where (box_id=54 or box_id=55 or box_id=56 or box_id=57) and start_type_id=84 and end_type_id=49 and (log_event_ut between unix_timestamp("2008-03-01 05:23:07") and unix_timestamp("2008-03-01 09:30:07"))) a3
where a2.log_type_id=89 and a2.abclog_id=a3.abclog_id) a4
where a1.log_type_id=86 and a1.abclog_id=a4.abclog_id;

+--------------------------------------+-----------------------------+
110214 rows in set (31.57 sec)


对了, 我用tee 把结果输出到一个文件里, 如何告诉MYSQL不要把那写符号(+, -)写出来, 因为我只要数据, 表格对我来说是麻烦.  我要用自己的SCRIPT对数据处理一下, 如果只有数据, 反而容易些.

论坛徽章:
0
12 [报告]
发表于 2008-03-04 00:25 |只看该作者
如果实在没有办法的话,就把SQL 语句分开吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP