i tried to do in my select a count functionlike this : SELECT WCD.debt_id, Comp.Name, WCD.client_id, WCD.client_name, WCD.AdminID, FA.FirstName + ' ' + FA.LastName AS AdminName, CONVERT(NVARCHAR(10), WCD.CreateDate, 103) AS CreateDate, COUNT(WCS.status_id) AS countStatus FROM WCD LEFT OUTER JOIN Comp ON WCD.CompanyID = Comp.CompanyID LEFT OUTER JOIN FA ON WCD.AdminID = FA.AdminId LEFT OUTER JOIN WCS ON WCD.debt_id = WCS.debt_id GROUP BY WCD.debt_id, Comp.Name, FA.FirstName + ' ' + FA.LastName, WCD.client_id, WCD.client_name, WCD.AdminID, WCD.CreateDate, WCS.status_id ORDER BY WCD.CreateDate DESC
the thing is that until i didnt add all the group by fields i got error messages!!!i thhought that its enough only to do :GROUP BY WCD.debt_id
why isnt this enought?thnaks i nadvancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)