可以用PIVOT 扭轉資料... declare @a table( id int ,[loop] int ,[value] int ) insert...
-- 使用 Postgresql create table ithelp191129 ( id smallint not null primary key...
with temp As ( if(mod(id,3)=0,3,mod(id,3)) AS id, select loop, value from x...
請先把你目前寫的語法貼出來,再說明一下遇到的困難在哪裡.
group by sum .....你有嘗試自己寫看看嗎?