I have table data after doing all joins and restrictions like this:
Name | Type | Path |
---|---|---|
Item 1 | mobile | /mobile/image1.jpg |
Item 1 | desktop | /desktop/image1.jpg |
Item 2 | mobile | /mobile/image2.jpg |
Item 2 | desktop | /desktop/image2.jpg |
I want the result table to look like this in the end:
Name | Path mobile | Path desktop |
---|---|---|
Item 1 | /mobile/image1.jpg | /desktop/image1.jpg |
Item 2 | /mobile/image2.jpg | /desktop/image2.jpg |
What SQL (mySQL) feature can be used to get such a result?
So far, I’ve had to do data processing (mapping) in the code that calls this request.
2
Answers
We can use conditional aggregation here: