I am trying to get a chart date vs number of patients .I am trying to make a chart using MS Chart in asp.net where I get date on x axis and number of patients on y axis. I am accepting from date and to date as input. I want number of patients between these 2 dates on each date between from and to date. I am trying something as follows
select
convert(varchar,creation_Date,105) as 'creation_Date',
count(Pat_ID)
FROM Patient_Ref_master
where
(CONVERT(VARCHAR(10),Patient_Ref_master.creation_Date,111) BETWEEN '2013/07/23' AND '2013/07/25')
group by Pat_ID
but giving me an error of
Msg 8120, Level 16, State 1, Line 1
Column 'Patient_Ref_master.creation_Date' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Where I am going wrong.? Please suggest. Thanks