sql豎表格怎么變成橫的 SQL如何進(jìn)行縱表轉(zhuǎn)橫表?
SQL如何進(jìn)行縱表轉(zhuǎn)橫表?因?yàn)槟鷽]有編寫commit來使用sqlplus,所以您必須編寫submit命令來實(shí)際向數(shù)據(jù)庫提交數(shù)據(jù)。當(dāng)前主流應(yīng)用程序仍然使用PL/SQL,它支持命令窗口,即包含sqlplu
SQL如何進(jìn)行縱表轉(zhuǎn)橫表?
因?yàn)槟鷽]有編寫commit來使用sqlplus,所以您必須編寫submit命令來實(shí)際向數(shù)據(jù)庫提交數(shù)據(jù)。當(dāng)前主流應(yīng)用程序仍然使用PL/SQL,它支持命令窗口,即包含sqlplus接口的窗口。
SQL如何進(jìn)行縱表轉(zhuǎn)橫表?
按名稱或選擇名稱從TB組中選擇名稱,“math”=max(case course when“math”then score ele 0 end),“Chinese”=max(case course when“Chinese”then score ele 0 end),“English”=max(case course when“English”then score ele 0 end),“math”=sum(case course when“math”then Score else 0 end),“Chinese”=sum(case course when“Chinese”then Score else 0 end),“English”=sum(case course when“English”then Score else 0 end)from TB group by name
這是將垂直表轉(zhuǎn)換為水平表,如以下數(shù)據(jù):“王明”、“書雪”、“王明”、“宇文”、“王明”、“迎玉”,您可以使用以下語句:選擇A.Vuname、A.Vuscore shuxue、b.Vuscore yuwen、c.Vuscore yingyu from tempu1 A、tempu1 b、tempu1 cwhere A.Vuname=b.Vuname and A.Vuname=c.Vuname and A.Vuname=“wangming”and A.Vucourse=“shuxue”and b.Vucourse=“yuwen”and c.Vucourse=“yingyu”