早教吧作业答案频道 -->其他-->
SQL多语句合成一个句子selectemployeenameas姓名,count(ondutystatus)as数量into##tempfromproddutyswhereondutystatus='请假(病假)'anddatepart(yy,date)=2010groupbyemployeenameorderby数量descselect*from##tempwhere
题目详情
SQL 多语句合成一个句子
select employeename as 姓名,count(ondutystatus)as 数量 into ##_temp from proddutys where ondutystatus='请假(病假)'and datepart(yy,date)=2010 group by employeename order by 数量 desc
select * from ##_temp where 数量 in(select distinct top 2 数量 from ##_temp )
这两个SQL 语句如何合成一条SQL语句.
select employeename as 姓名,count(ondutystatus)as 数量 into ##_temp from proddutys where ondutystatus='请假(病假)'and datepart(yy,date)=2010 group by employeename order by 数量 desc
select * from ##_temp where 数量 in(select distinct top 2 数量 from ##_temp )
这两个SQL 语句如何合成一条SQL语句.
▼优质解答
答案和解析
其实很简单,在第一条语句后面加一个英文的分号就行了,这样执行查询就会得到两个记录集(在ASP.NET中是一个DATASET中的两张表),接着按你实际需求去使用哪一张表就行了!
select employeename as 姓名,count(ondutystatus)as 数量 into ##_temp from proddutys where ondutystatus='请假(病假)'and datepart(yy,date)=2010 group by employeename order by 数量 desc;select * from ##_temp where 数量 in(select distinct top 2 数量 from ##_temp )
select employeename as 姓名,count(ondutystatus)as 数量 into ##_temp from proddutys where ondutystatus='请假(病假)'and datepart(yy,date)=2010 group by employeename order by 数量 desc;select * from ##_temp where 数量 in(select distinct top 2 数量 from ##_temp )
看了 SQL多语句合成一个句子se...的网友还看了以下:
关于x的分式方程x-x分之一=t-t分之一的解为x1=t,x2=﹣t分之一:x+x分之一=t+t分 2020-05-01 …
关于矩阵的秩的问题题:设A为4×3矩阵,B为3×4矩阵,且R(A)=2,R(B)=3,求R(AB) 2020-05-13 …
连字成词(英语)l u o e b s r u s r e t o s w a e s r t e 2020-05-14 …
已知字母组合成英语单词1、e e t t i n h r 2、e e r a t w h 3、o 2020-05-14 …
1)有三个关系R,S和T如下 R(AB m1 n2) S(BC 13 35) T(ABC m13) 2020-05-17 …
∮1dx/(x^2+y^2+z^2)ds,其中,曲线x=(e^t)sinty==(e^t)cost 2020-06-03 …
傅立叶变换的两道题目(1):f(at)的傅立叶形式.(2)f(t)=e[t*t/2a*a](因为上 2020-06-30 …
英语单词填空1.时间状语:d-r-n-2.场所:b-s-s-o-f-r--e-a-t-e-t3.教 2020-07-14 …
定态薛定谔方程问题定态薛定谔方程的解ψ(r,t)=ψ(r)f(t)=ψ(r)e^(-i/h*Et) 2020-07-23 …
已知文法G:(1)E→E+T|T(2)T→T*F|F(3)F→P↑F|P(4)P→(E)|i1.已知 2020-12-07 …