I would like to group by fewer columns, but I get an error trying to
compile.
As an example, eleminating the SHIFT column from group by gives the
following error:
Msg 8120, Level 16, State 1, Procedure PWQR_Select_Teardown_15_Day_Summary,
Line 26
Column 'TWQRHISTEARDOWN_HEADER.WQR_TDH_SHIFT_X' is invalid in the select
list because it is not contained in either an aggregate function or the
GROUP BY clause.
"Plamen Ratchev" <Pl****@SQLStudio.comwrote in message
news:HZ******************************@speakeasy.ne t...
What happens when you add the column WQR_TDH_HEADER_ID to both SELECT and
GROUP BY? If you get rows you consider non-duplicate show as duplicate,
then most likely your grouping does not include all significant columns to
consider one row unique.
HTH,
Plamen Ratchev
http://www.SQLStudio.com