I have a table with primary key as (state+city)
and other columns (product1, product2, product3, product4)
. I am trying to create a new table where each row will correspond to (state+city)
& (one of) products + some static_value columns. How do I do it in a PostgreSQL query?
It's probably better to see examples of input and output data that I am looking at. I checked various examples of converting rows to columns in MySQL or SQL Server on this forum but they don't seem to help me.
Example data sheet ('Input Table' and 'Desired Output' tabs)