如何在sql server中将三个平均结果加入到一个结果中

时间:2014-03-29 07:48:09

标签: sql sql-server

我有三个这样的查询:

select  avg( datediff(mi,t.dtime, t.PAICdate )) as Avgparkingtime 
from (
    select top 10 * from transaction_tbl where locid=6 order by transactID desc
) t

select  avg( datediff(mi,t.Paydate, t.DelDate )) as AvgDelivarytime  
from (
    select top 10 * from transaction_tbl where locid=6 order by transactID desc
) t


select  avg( datediff(mi,t.dtime, t.DelDate )) as Avgstaytime 
from (
    select top 10 * from transaction_tbl where locid=6 order by transactID desc
) t

我这样出去了:

Avgparkingtime
--------------
23

AvgDelivarytime
---------------
38
Avgstaytime
-----------
39

我怎么能加入这三个quires ..我想把这三个结果连成一行.. 我的期望是这样的:

 Avgparkingtime     AvgDelivarytime    Avgstaytime
  --------------     --------------    ------------
    23                    38                39

我怎么能做到这一点?

0 个答案:

没有答案