子查询(SQL 2000) select * from (select * from xx where a=1) tem where tt=2 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 eg:1: Select a,b,c,d from table1 where ...2: Select a,sum(b) from (Select a,b,c,d from table1 where ...) abcd --别名,可以任意指定 group by a 3:再加一层 Select * from (Select a,sum(b) from (Select a,b,c,d from table1 where ...) abcd --别名,可以任意指定 group by a) abwhere a > 100 用临时表可以实现:select * into #aa from xx where a=1select * from #aa where tt=2drop table #aa select * from (select * from xx where a=1) 别名必须写,但你可以随便写一个 where tt=2 to yujohny(踏网无痕)我也是这样想的,但是临时表是有生存周期的。我现在的问题是当我执行完一个sql后,我可以把结果放到临时表中,但我不知道当我执行下一个sql的时候这张临时表是否还存在,还有就是我能不能把查询结果存入这张临时表中 那你可以做一个全局临时表阿, 完了再drop不就可以了吗 sql server 2005创建数据库出错 跪求一条SQL语句。 问一个SQL语句 一个比较麻烦的sql语句问题 能用SQL语句完成吗?我都有点晕了 请教一个关于统计并排序的sql写法 建哥,如何截取这段字符? 一个很特殊的Sql语句,看哪位高手能够写出来 如何删除数据库? 一个产品多个价格的查询语句! 目前有一项目,不知怎么操作。不知有愿意合作的么? 思归等高手,可以解决么-如何对union后的结果排序呢?
1: Select a,b,c,d from table1 where ...
2:
Select a,sum(b) from
(Select a,b,c,d from table1 where ...) abcd --别名,可以任意指定
group by a
Select * from (
Select a,sum(b) from
(Select a,b,c,d from table1 where ...) abcd --别名,可以任意指定
group by a
) ab
where a > 100
用临时表可以实现:select * into #aa from xx where a=1select * from #aa where tt=2drop table #aa
我也是这样想的,但是临时表是有生存周期的。
我现在的问题是当我执行完一个sql后,我可以把结果放到临时表中,但我不知道当我执行下一个sql的时候这张临时表是否还存在,还有就是我能不能把查询结果存入这张临时表中