Not sure i am explaining it well in the title, I am trying to create a few views, but i am wondering if what i am wanting to accomplish is even possible.
I have a table:
|Column1|Column2|Column3| Column4 |
| 1 |1234 | Foo | 19/11/2021|
| 2 |1234 | Foo | 19/11/2021|
| 3 |1234 | Foo | 19/11/2021|
| 1 |1234 | Bar | 19/11/2021|
| 2 |1234 | Bar | 19/11/2021|
| 3 |1234 | Bar | 19/11/2021|
| 1 |1234 | Baz | 19/11/2021|
| 2 |1234 | Baz | 19/11/2021|
| 3 |1234 | Baz | 19/11/2021|
The Unique of the table on this is Column1, Column2, Column3.
When querying this data in a view, because of the type of join i am getting, i am getting Column1, and Column 2 showing multiple times because of the multiple entries in Column 3. This is what i expected.
But is there any way or query in sql that can do something like: for-each column 3, assigning it to column4, column5, column5.
For example:
|Column1|Column2|Column3| Column4 | Column3a | Column3b | Column3c |
| 1 |1234 | Foo | 19/11/2021| Foo | Bar | Baz |
| 2 |1234 | Foo | 19/11/2021| Foo | Bar | Baz |
| 3 |1234 | Foo | 19/11/2021| Foo | Bar | Baz |
The number of unique in Column3 can be be any, so it would have to be programmable like a foreach column+1 This is working with existing data, so its not possible to reformat how its already present, i am working with a poorly designed database and trying to create views to make it more readable and workable for a API Endpoint