I need some help writing my store proc, I tried both of the following but it does'st seem to work. Your suggestions would be appreciated.
SELECT count(LeadId)
FROM dbo.Cl_Leads
Where AccntMng=@AccntMng and (Status = 'Won' or Status = 'Lost') and InsertDate BETWEEN @dtStart AND @dtEnd
I also tried
SELECT count(LeadId)
FROM (SELECT * FROM dbo.Cl_Leads WHERE InsertDate BETWEEN @dtStart AND @dtEnd)
Where AccntMng=@AccntMng and (Status = 'Won' or Status = 'Lost')
This return and error: Incorrect syntax near the keyword 'Where'.