I have a couple of tables
Table 1:
meter_id | date
1 2019-01-01
Table 2:
meter_id | read_date | period | read
1 2019-01-01 1 5
1 2019-01-01 2 6
1 2019-01-01 5 2
1 2019-01-01 6 1
1 2019-01-01 7 2
2 2019-01-01 1 3
2 2019-01-01 2 10
1 2019-01-02 6 7
Is it possible to generate a series of columns so I end up with something like this:
meter_id | read_date | p_1 | p_2 | p_3 | p_4 | p_5 | p_6 ...
1 2019-01-01 5 6 2 1
2 2019-01-01 3 10
1 2019-01-02 7
where there are 48 reads per day (every half hour)
Without having to do multiple select statements?