August 17, 2017 at 11:34 pm
I would like to write a query against one table which gives unique value from "pm_process_guid" for one ticket, along with all associated values in Assigned Group, Assigned User and Time on a column wise. Could one of you please help me out in how I should write a query in order to get a output like 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 AM Raj 3/23/2016 15:06
2E2A9A43-9607-4FCB-B3A7-550440823B20 3 APAC Sree 3/23/2016 15:06
I need to get an output like 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 AM Raj 3/23/2016 15:06 APAC Sree 3/23/2016 15:06
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
August 18, 2017 at 4:01 am
Welcome to SSC.
It's always important to make sure that when asking questions, you give as much details as possible, but also provide the information with it in a consumable format, Have a look at the link in my signature on how to post T-SQL questions, written by the "marvellous" Jeff Moden. Once you've had a read, post back with your DDL, DLM and expected output in a readable format, and I'm sure someone will be more than happy to help you out. 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
August 18, 2017 at 4:35 am
What happens if there are more than three groups? Do you need to add more and more columns if there are?
Is this for a report? I would recommend that you just return the data from SQL Server and let your front end handle the pivoting.
John
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply