Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kathyc
Starting Member
9 Posts |
Posted - 2009-03-14 : 14:51:29
|
| HelloI am getting the following error in my query and don't know what I've done wrong.Msg 8120, Level 16, State 1, Line 7Column 'dbo.FilteredOpportunity.contactidname' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.Here is my code...DECLARE @StartDate DATETIMEDECLARE @EndDate DATETIMESET @StartDate = '1/1/2009'SET @EndDate = '12/12/2009'SELECT customeridname, contactidname, actualvalue, actualclosedate, COUNT(customeridname) AS MyTotal FROM dbo.FilteredOpportunityWHERE actualclosedate BETWEEN @StartDate AND @EndDate AND statecode = 1GROUP by customeridnameORDER BY actualclosedate; |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
|
|
|
|
|