クエリを使用して取得したこのテーブルがあるとしましょう
私はこのようなものを与えることができるクエリに取り組んでいます
これが私がこれまでに試したことです:
Select [First Name], [Last Name], Club,
case when Competition='La Liga' then Wins end as [La Liga],
case when Competition='Copa del Rey' then Wins end as [Copa del Rey],
case when Competition='Supercopa de Espana' then Wins end as [Supercopa de Espana],
case when Competition='UEFA Champions League' then Wins end as [UEFA Champions League],
case when Competition='UEFA Super Cup' then Wins end as [UEFA Super Cup],
case when Competition='FIFA Club World Cup' then Wins end as [UEFA Super Cup]
From dbo.Table
Group by [First Name], [Last Name], Club
しかし、集計関数にも GROUP BY 句にも含まれていないため、選択リストで「SQL 実行エラー」列 'dbo.Wins' が無効です。列 'dbo.Competition' は、集計関数にも GROUP BY 句にも含まれていないため、選択リストでは無効です。
列「Wins」と「Competition」を GROUP BY 句に入れても、必要な結果が得られません。
他の提案はありますか?
前もって感謝します