Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Data Grouping on 2 levels but only returning conditional data RE: Data Grouping on 2 levels but only returning conditional data
logitestus
SSCrazy
Points: 2928
More actions
May 7, 2014 at 6:10 pm
#1711734
My apologies. That row shouldn't be returned as 1200.0 but as 2500.0. I can completely understand the confusion.
The logic is where document type (doc_type column) is 'S' for 'Starting', 'E' for Ending; grab the associated 'A' record.