| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 909 人关注过本帖
标题:【新手求助】两段查询命令分析 不知道错哪了?
只看楼主 加入收藏
有时寂寞
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-8-24
收藏
 问题点数:0 回复次数:2 
【新手求助】两段查询命令分析 不知道错哪了?
1)此查询命令运行后 priv_more表自动删除了,不知道为什么    若不用 drop table priv_more  则显示语法错误?
drop table priv_more select hm, count(hm) as expr1 into priv_more from tt where fx=1 or fx = 2 or (fx>432 and fx<443) group by hm;
having (count(hm) > 1) select * from priv_more select id,hm,fx,je from tt where hm in (select hm from priv_more)


2)此命令并没有检查出错误,但查询的时候容易卡死,40万的数据 查半天也不会走。
select * from tt,tt1 where tt.fx=tt1.fx and tt.hm=tt1.hm and tt.je<>tt1.je and tt.je>0 and tt1.je>0


以上两个查询命令 求教高手帮忙解释下,谢谢了
搜索更多相关主题的帖子: 命令 查询 
2008-08-27 12:05
ibmlang_002
Rank: 5Rank: 5
来 自:浙江-嘉兴
等 级:贵宾
威 望:18
帖 子:437
专家分:176
注 册:2008-8-30
收藏
得分:0 
2)此命令并没有检查出错误,但查询的时候容易卡死,40万的数据 查半天也不会走。
select * from tt,tt1 where tt.fx=tt1.fx and tt.hm=tt1.hm and tt.je<>tt1.je and tt.je>0 and tt1.je>0


如果两个表都有40万条记录,那么join后就有40万X40万条记录。你想想有多厉害。加ON条件吧。
2008-09-05 13:09
szy345
Rank: 4
来 自:江苏——南京
等 级:贵宾
威 望:14
帖 子:336
专家分:14
注 册:2008-8-6
收藏
得分:0 
drop table XX,就是删除表
去掉以后下面的
“having (count(hm) > 1)
select * from priv_more select id,hm,fx,je from tt where hm in (select hm from priv_more)
”还有这样的连写的语句???
2008-09-05 14:12
快速回复:【新手求助】两段查询命令分析 不知道错哪了?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.010911 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved