Oracle SQL pivot translation -


i have table follows:

snf                 sfcm        pool            quota                            eng         11                            sud         20 b                   uk          aau         30 

but displayed follows:

snf      sfcm        eng       sud     aau                 11        20          b        uk                            30 

i have tried use pivot follows

select a.* test pivot ( sum(quota) quota pool in ('eng', 'sud', 'aau') ) 

but can't seem correct output.

would able advise me? also, wondering if possible use sql statement instead of 'eng', 'sud', 'aau'. in(select pool test).

thanks.

your query should follows:

select snf, sfcm, eng_quota, sud_quota, aau_quota nc_so1 pivot ( sum(quota) quota pool in ('eng' eng, 'sud' sud, 'aau' aau) ) 

also not possible generate dynamic list using sql afaik


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -