I know there are many questions posted with this topic, but I couldn't find the answer I wanted. I'm trying to query two joined tables and have a distinct record for each clientid. Currenty, my query is returning many duplicate with the same clientid number. Please help me tweak this query to only return distinct records for each client id. Thanks!
declare @StartDate datetime,
Set @StartDate='2005-10-01 00:00:00.000'
Set @EndDate='2006-12-01 00:00:00.000'
SELECT DISTINCT a.clientid, a.clientname, b.date, b.jobnumber FROM tblClient a INNER JOIN tblScheduleAssignments b
where a.officeid = 4 and active = 1 and date >= @startdate and date <= @enddate and clientname NOT LIKE '%CSD%'