Re: [SQL ] 關於select資料

看板Database作者 (世界盡頭小酒館)時間17年前 (2008/11/22 03:16), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/3 (看更多)
測試環境:SQL Server 2008 select avg(p_speed) as avg_speed,avg(p_time) as avg_time from ( select (speed1+speed2)/2 as p_speed,(t2-t1) as p_time from ( select [name] ,speed as speed1,[time] as t1 from aaa2 where place='0' ) as tp1 inner join ( select [name] ,speed as speed2,[time] as t2 from aaa2 where place='1' )as tp2 on tp1.[name]=tp2.[name] ) as t ========================= 執行結果 avg_speed avg_time 37 54 完成 -- 我討厭欄位名稱叫name或time >"< -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.224.44.230 ※ 編輯: decadance 來自: 61.224.44.230 (11/22 03:50)

11/22 15:28, , 1F
感恩 謝謝謝謝!!!
11/22 15:28, 1F
文章代碼(AID): #199ma7gb (Database)
文章代碼(AID): #199ma7gb (Database)