PostgreSQL crosstab query - Rotate a table about a pivot - Hallo sahabat Dev-Create, Pada Artikel yang anda baca kali ini dengan judul PostgreSQL crosstab query - Rotate a table about a pivot, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan
Artikel crosstab,
Artikel postgres,
Artikel rotate,
Artikel table, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.
Judul : PostgreSQL crosstab query - Rotate a table about a pivot
link : PostgreSQL crosstab query - Rotate a table about a pivot
Anda sekarang membaca artikel PostgreSQL crosstab query - Rotate a table about a pivot dengan alamat link https://dev-create.blogspot.com/2011/10/postgresql-crosstab-query-rotate-table.html
Judul : PostgreSQL crosstab query - Rotate a table about a pivot
link : PostgreSQL crosstab query - Rotate a table about a pivot
PostgreSQL crosstab query - Rotate a table about a pivot
An interesting feature of relational databases(postgres in this case) is the ability to rotate the table about a pivot. So if you have data like this-
id | rowid | key | value
---+------+----+-------
1 | test1 | key1 | val1
2 | test1 | key2 | val2
3 | test1 | key3 | val3
4 | test1 | key4 | val4
5 | test2 | key1 | val5
6 | test2 | key2 | val6
7 | test2 | key3 | val7
8 | test2 | key4 | val8
And want to have a result set like this -
rowid | key1 | key2 | key3 | key4
------+------+-----+-----+------
test1 | val1 | val2 | val3 | val4
test2 | val5 | val6 | val7 | val8
It can be achieved by a "crosstab" query in a postgres database -
Update: 02/14/2013
The following can be achieved by a crosstab and also by an interesting SQL which I came across here - http://stackoverflow.com/questions/14863985/postgres-crosstab-maybe
id | rowid | key | value
---+------+----+-------
1 | test1 | key1 | val1
2 | test1 | key2 | val2
3 | test1 | key3 | val3
4 | test1 | key4 | val4
5 | test2 | key1 | val5
6 | test2 | key2 | val6
7 | test2 | key3 | val7
8 | test2 | key4 | val8
And want to have a result set like this -
rowid | key1 | key2 | key3 | key4
------+------+-----+-----+------
test1 | val1 | val2 | val3 | val4
test2 | val5 | val6 | val7 | val8
It can be achieved by a "crosstab" query in a postgres database -
Update: 02/14/2013
The following can be achieved by a crosstab and also by an interesting SQL which I came across here - http://stackoverflow.com/questions/14863985/postgres-crosstab-maybe
Demikianlah Artikel PostgreSQL crosstab query - Rotate a table about a pivot
Sekianlah artikel PostgreSQL crosstab query - Rotate a table about a pivot kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel PostgreSQL crosstab query - Rotate a table about a pivot dengan alamat link https://dev-create.blogspot.com/2011/10/postgresql-crosstab-query-rotate-table.html