I’m working with a sql table that looks like this:
ID Region Store Sales
1 MEX Supermarket 10,000
2 USA Supermarket 5,000
3 MEX Club 10,000
4 USA Direct 1,000
5 MEX Direct 4,000
6 USA Club 0
I have 8 different region options(just 2 here to make it shorter). Also, 3 store options, and I want to display the info like this:
Store MEX USA
Supermarket 10,000 5,000
Club 10,000 0
Direct 4,000 1,000
So, I don’t know what to choose to display the info like a table to compare the sales between the regions in each store segment, which would be the correct sql to call them and order in columns to make it look like the table.
Good candidate for PIVOT operator. Check this example.
For your situation, try this. You can add additional columns besides MEX and USA.