Skip to content
Advertisement

insert statement in postgresql

I have a table with 8 records.

I have 4 records for Dec-17, same 4 records for Jan-18 (only yearmon changes)

I am trying to have same records for the month of Feb-18 as well. All the column values should be same, only the yearmon has to change to Feb-18.

I can write an insert statement if I have less than 5 records. Is there any other way to write a query to get the desired output?

Output looks like

Advertisement

Answer

First insert all Distinct values of income, score_1, score_2, RANK combination. then update yearmon to Feb-18

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement