I'm looking to take the following table and represent the data in the format outlined below.
All the Type A dates
as column Date 1
and Type B dates
as column Date 2
. Type A
will always have more rows than Type B
so for any missing rows I need null to be included instead.
I not sure what type of transformation this is so much question may be misleading.
The query can be written in mysql >=5.7
Type A -> Date 1
Type B -> Date 2
------------------
| Table |
-----------------|
| type | date |
| A | 2019-01 |
| A | 2019-02 |
| A | 2019-03 |
| A | 2019-04 |
| B | 2018-10 |
| B | 2018-11 |
------------------
I want to transform the data to the following:
------------------------
| Date 1 | Date 2 |
| 2019-01 | 2018-10 |
| 2019-02 | 2018-11 |
| 2019-03 | null |
| 2019-04 | null |
-------------------------