lundi 11 juillet 2016

SQL Server combine multiple rows into single row

Any help is much appreciated. I have the following query and need help in modifying it to combine multiple rows into single row with data separated by comma. I have attached the image for your reference. select CT_ID , Acct_Group , (source + ' - ' + cast(count(*) as nvarchar(20)) +' account groups have total amounts in file A more or less than 25% of File B AMount' ) as Error from ( select CT_ID , source , acct_group , sum(balance) as Balance , sum(k_new_balance) as K_New_Balance from tblGroups group by acct_group, source, CT_ID ) as x where abs((K_New_Balance - Balance)/nullif(Balance, 0)) >=0.25 group by source, CT_ID,Acct_group order by CT_ID

Aucun commentaire:

Enregistrer un commentaire