Help us understand the problem. What is going on with this article?

oracle SQL pivot

pivotを使った検索結果の表示

テーブル

学年 名前 点数
1 1 田中太郎 100
1 2 佐藤次郎 90
1 2 鈴木三郎 80
1 1 齋藤四郎 90
SELECT *
FROM テーブル名
WHERE 点数 > 89
PIVOT(集約関数(点数) 
   FOR 名前 IN ( 100 AS '100点' ,
               90  AS '90点'
              ))

結果

学年 100点 90点
1 1 田中太郎 NULL
1 2 NULL 佐藤次郎
1 1 NULL 齋藤四郎

カラム名に挿入したい箇所に値をいれることができる

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした