This is the table I have currently. I would like to combine everything as one event_code and have everything in one line. I checked stack and google and got different answers which doesn't seem to solve my issue.
What I would like to have is
**event_code : fs_rev : hs_rev : pp_rev : mp_rev : gp_rev : in_rev : broker**
LAK180918 : 619500 : 0 : 7000 : 0 : 5000 : 8500 : 17500
I can't seem to find the answer on how to do this, by combining all the columns under one row. Can anyone suggest what i should do?
You can use Max or Min function. I am assuming you will have only one valid value for each column in the event.
select event_code, max(fs_rev),max(hs_rev),max(pp_rev),max(mp_rev)
,max(gp_rev),max(in_rev),max(broker)
from table
group by event_code