9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ORACLEの機能を使って、複数レコードのデータを1レコードのCSVデータにする

9
Posted at

ORACLEの機能を使って、複数レコードのデータを1レコードのCSVデータにする

  • データを縦横変換しつつCSVデータにしたい場合のスクリプト
SQL

-- 複数レコードのデータを、カンマ区切りの1レコードに出力する方法
SELECT
    LISTAGG(DATA_COL,',') WITHIN GROUP (order by DATA_COL) AS CONCAT_NAME
FROM
    SAMPLE_TABLE
/

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?