| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1202 人关注过本帖
标题:关于一句SQL语句,希望大神帮我简化下。
只看楼主 加入收藏
scj930514
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-4-3
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
关于一句SQL语句,希望大神帮我简化下。
由于查询太过费时导致程序很卡,所以希望大神们帮我看下,如何优化这句SQL语句!谢谢了
select distinct(t1.stackId)  FROM [test].[dbo].[stackAssemb] t1   
where t1.assembNum =(select MAX(t2.assembNum) FROM [test].[dbo].[stackAssemb] t2
where t2.stackNum =t1.stackNum) and t1.workorder ='WO-STK0134' and  t1.stackId not in
( select   from  [test].[dbo].[stackInventory]  t3 where t3.AC ='入库'
and  t3.timesNum  =1 and t3.wo ='WO-STK0134' union select stackId from stackTest
where testType='post' and workorder ='WO-STK0134' )and t1.stackId in
(select stackId from stackTest where  testType='pre' and type2='叠阵' and workorder ='WO-STK0134')
搜索更多相关主题的帖子: 如何 where 
2015-04-03 13:47
执笔画江山
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:265
专家分:1010
注 册:2015-1-13
收藏
得分:20 
看着这代码 醉了 我先去 吃饭 坐等大神

授人以鱼,不如授人以渔
2015-04-03 19:37
aAXZL雪中狼
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-4-12
收藏
得分:0 
请君另请高就吧
2015-04-12 20:39
快速回复:关于一句SQL语句,希望大神帮我简化下。
数据加载中...
 
   



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

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