0
我想在mysql中重新創建一些在MS SQL中創建的東西。我有一段時間讓語法正確。有誰知道什麼等效的MySQL查詢將爲以下內容:sql-server到mysql的翻譯
create table #tmp
(id int, Ran varchar(10), Result int, ref_id int)
insert #tmp values (1, 'Object1', 4.0, 1)
insert #tmp values (2, 'Object2', 100, 1)
insert #tmp values (3, 'Object1', 6.0, 2)
insert #tmp values (4, 'Object3', 89.0, 2)
select * from #tmp
Select t.ref_id
,TK = max(case when t.Ran ='Object1' then t.[Result] end)
,CRP= max(case when t.Ran ='Object2' then t.[Result] end)
,HPT= max(case when t.Ran = 'Object3' then t.[Result] end)
From #tmp t
group by t.ref_id
謝謝你看一看!
什麼是你得到錯誤信息? – dpw 2014-12-06 01:09:06