sql 学习笔记 p46

交换行

update tab1 set c1=c2,c2=c1  。说明sql是临时表的存储,在查询出来的结果为决定前,可以随意操纵临时表中的列

update tab set c1=c1+(select max(c1) from tab)

对于视图,子查询,函数本来不允许有排序函数的,但是在加上 top 后这样的操作又是可行的。

select * from (
select top 100 D_day,D_branch from T_Day_Rd_Cash order by D_branch) as D
where D_day>'2015-10-01'

top :可以试数目,也可以是 percent 

原文地址:https://www.cnblogs.com/zoumin123/p/4941265.html