私はオンラインで見て、次の問題の答えを見つけることができませんでした。シングルグループ機能 - カテゴリと地域別の製品数
以下の表を作成します。 Count_product_A
とcount_product_B
以外のすべての列を作成できました。テーブルへ
リンク:TABLE1に
がリンク:
Select
Region_flag, type, count(total product)
,sum(Case when product in ('A') then count(total product) END) as count_product_A
,sum(Case when product in ('B') then count(total product) END) as count_product_B
FROM Table1
Group by
Region_flag, type
何あなたはcount_product_Aと_Bをしますか? COUNTのSUM?それとも、製品の数だけ? – RealCheeseLord
はい数値の合計 – Soph
テーブルの一部を追加できますか? – RealCheeseLord