Hi, i have this query that is perfect on SQL2005 but in SQL2000 it gives me the error: "Column 'D.RevenueCode' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."SELECT SUBSTRING(D.RevenueCode, 5, 2) + ' ' + (SELECT A.sdp_des FROM vw_UNI_se_girev A WHERE A.sdp = SUBSTRING(D.RevenueCode, 5, 2) AND Cast(A.Comp AS Integer) = D.CompanyCode) AS RevenueGrpItem,SUM(nSign * isNull(ItemAmount, 0)) AS GrandTotalFROM SIC_Invoice_Header AS H, vw_SIC_Invoice_Detail AS DWHERE H.CompanyCode = 1 AND H.StockCategory = 'INV' AND H.CompanyCode = D.CompanyCode AND H.StockCategory = D.StockCategory AND H.SaleType = D.SaleType AND H.TransactionType = D.TransactionType AND H.SerialNo = D.SerialNo AND D.RevenueCode is not NULLGROUP BY D.CompanyCode, SUBSTRING(D.RevenueCode, 5, 2)ORDER BY SUBSTRING(D.RevenueCode, 5, 2)
It appears that when I remove the + and put a comma it works correctly but that's not what I want !Any suggestions?Thanks in advanceLaurent