Hello,I am trying to compile a SP that filter my results of a view by evaluating a date range using the Between keyword. all three columns are formatted the same way, but the two values that make up the range are SP variables---column from viewcheckdate = CONVERT(DATETIME,SUBSTRING('2008080101',1,8),10)--defined variablesselect @startdate= CONVERT(DATETIME,SUBSTRING('2008010101',1,8),10)select @enddate = CONVERT(DATETIME,SUBSTRING('200801201',1,8),10)select checkdate from vw_data where Code = 'CIP' AND checkdate BETWEEN @Startdate AND @Enddate
Then when I try to create the SP, I get this error:vw_data.checkdate' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause
Any idea why this occurs because all three date values seemed to be formatted the same way.Thanks