![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Dear PostgreSQL experts, Is it possible to automize crosstab queries on a normalized database in PostgreSQL? A minimal example is a table with the results of students in different exams: student | date_of_exam | grade ------------------------------ Peter | 2010-09-09 | 2 Tom | 2010-09-09 | 1 Andy | 2010-09-21 | 3 Tom | 2010-09-21 | 4 Peter | 2010-09-21 | 1 Peter | 2010-10-11 | 2 This can be transformed to a denormalized view like: student | grade_2010_09_09 | grade_2010_09_21 | grade_2010_10_11 ---------------------------------------------------------------- Peter | 2 | 1 | 2 Tom | 1 | 4 | NULL Andy | NULL | 3 | NULL However, each time the results of a new exam are inserted, the view has to be adjusted by hand. Is there a way of doing this automatically? |
![]() |
| Thread Tools | |
| Display Modes | |
| |