tonyvee1973
IS-IT--Management
Hi
I am trying to sort a grouping out but cant get the syntax right for the CAST function.
Below is what i'm trying to convert but keep getting the error "Column 'dbo.SL_ACCOUNTS.CU_NOTES' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause"
group by dbo.sl_accounts.cucode, dbo.SL_ACCOUNTS.CUNAME, dbo.ps_addresses.AddressLine1, dbo.ps_addresses.AddressLine2, dbo.ps_addresses.AddressLine3, dbo.ps_addresses.AddressLine4,
dbo.ps_addresses.AddressLine5, dbo.SL_ACCOUNTS.CUPHONE, dbo.SL_ACCOUNTS.CUFAX, dbo.SL_ACCOUNTS.CU_TOT_DISC, dbo.SL_ACCOUNTS.CU_SETT_DISC_1, dbo.SL_ACCOUNTS.CU_CREDIT_LIMIT,
dbo.SL_ACCOUNTS.CUCONTACT, dbo.SL_ACCOUNTS.CU_ON_STOP, dbo.SL_ACCOUNTS.CU_PRICE_KEY, dbo.SL_ACCOUNTS.CUUSER1, dbo.SL_ACCOUNTS.CUTURNOVERPTD, dbo.SL_ACCOUNTS.CUTURNOVERYTD,
dbo.SL_ACCOUNTS.CUBALANCE, dbo.SL_ACCOUNTS.CUCURRENCYCODE, Cast (dbo.SL_ACCOUNTS.CU_NOTES as varchar)
I am trying to sort a grouping out but cant get the syntax right for the CAST function.
Below is what i'm trying to convert but keep getting the error "Column 'dbo.SL_ACCOUNTS.CU_NOTES' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause"
group by dbo.sl_accounts.cucode, dbo.SL_ACCOUNTS.CUNAME, dbo.ps_addresses.AddressLine1, dbo.ps_addresses.AddressLine2, dbo.ps_addresses.AddressLine3, dbo.ps_addresses.AddressLine4,
dbo.ps_addresses.AddressLine5, dbo.SL_ACCOUNTS.CUPHONE, dbo.SL_ACCOUNTS.CUFAX, dbo.SL_ACCOUNTS.CU_TOT_DISC, dbo.SL_ACCOUNTS.CU_SETT_DISC_1, dbo.SL_ACCOUNTS.CU_CREDIT_LIMIT,
dbo.SL_ACCOUNTS.CUCONTACT, dbo.SL_ACCOUNTS.CU_ON_STOP, dbo.SL_ACCOUNTS.CU_PRICE_KEY, dbo.SL_ACCOUNTS.CUUSER1, dbo.SL_ACCOUNTS.CUTURNOVERPTD, dbo.SL_ACCOUNTS.CUTURNOVERYTD,
dbo.SL_ACCOUNTS.CUBALANCE, dbo.SL_ACCOUNTS.CUCURRENCYCODE, Cast (dbo.SL_ACCOUNTS.CU_NOTES as varchar)