Group by Wrap up Code
I am having a challenge with getting my data to group according the respective wrap up code.
I have a view that looks like screenshot A, my attempt results in screenshot B when in actual fact my results need to return Screenshot C.
In short I need to group the NULLS into the respective final outcome for that SegmentType Interact+hold+wrap make up one call
Apologies in advance for the post format.
SELECT TOP 1000 vw_Conversations.direction ,vw_Conversations.conversationId ,vw_Conversations.username ,vw_Conversations.conversationStart ,vw_Conversations.wrapUpCode ,DATEDIFF_BIG(MILLISECOND, vw_Conversations.segmentStart, vw_Conversations.segmentEnd) AS Duration FROM dbo.vw_Conversations WHERE vw_Conversations.purpose = 'user' OR vw_Conversations.purpose = 'agent' AND vw_Conversations.segmentType <> 'alert' GROUP BY vw_Conversations.direction ,vw_Conversations.username ,vw_Conversations.wrapUpCode ,vw_Conversations.conversationStart ,DATEDIFF_BIG(MILLISECOND, vw_Conversations.segmentStart, vw_Conversations.segmentEnd) ,vw_Conversations.conversationId