sql - How to write a query against one table which gives unique value from "pm_process_guid" -


i write query against 1 table gives unique value "pm_process_guid" 1 ticket, along associated values in assigned group, assigned user , time on column wise. how can write query in order output below?

pm_process_guid assign serial number    assigned group  assigned user              time 2e2a9a43-9607-4fcb-b3a7-550440823b20    1   apac    ram     3/23/2016 15:06 2e2a9a43-9607-4fcb-b3a7-550440823b20    2        raj     3/23/2016 15:06 2e2a9a43-9607-4fcb-b3a7-550440823b20    3   apac    sree    3/23/2016 15:06 

i‌ need output below,

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pm_process_guid totalassign count   1st group   1st user         time          2nd  group   2nd user         time   3rd group   3rd user         time 2e2a9a43-9607-4fcb-b3a7-550440823b20    3                   apac    ram 3/23/2016             15:06                   raj    3/23/2016      15:06            apac    sree    3/23/2016      15:06           ‌‌ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

here sample syntx on how it.

select  pm_process_guid,         count(*),         [1st user] = max(case when assignserial = 1 assignuser end),         [2nd user] = max(case when assignserial = 2 assignuser end),         . . .     yourtable group pm_process_guid 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -