error 8120 not contained aggregate function error

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Josema (Jestrade_at_ocu.org)
Date: 10/06/04


Date: Wed, 6 Oct 2004 08:57:02 -0700

Hi to all,

Im getting an error 8120:
Column <column name> is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause.

In my procedure i want to select from two tables CCList and CCThemes some
values, and all group by CCList.CalculationTheme

CREATE PROCEDURE dbo.CC_GetCCByTheme
@ThemeID int
AS
Select CCList.CalculationID, CCList.CalculationName, CCThemes.ThemeName,
CCList.CalculationURL, CCList.CalculationDate, CCThemes.ThemeImage,
CCList.CalculationClosed

from CCList inner join CCThemes on CCThemes.ThemeID=CCList.CalculationTheme

where CCList.CalculationTheme=@ThemeID Group By CCList.CalculationTheme

Why this error its returning?

-- 
Thanks
Regards.
Josema


Relevant Pages

  • RE: error 8120 not contained aggregate function error
    ... Change you select to return only the column that you group by and the query ... > contained in either an aggregate function or the GROUP BY clause. ... > from CCList inner join CCThemes on CCThemes.ThemeID=CCList.CalculationTheme ...
    (microsoft.public.sqlserver.programming)
  • Re: error 8120 not contained aggregate function error
    ... > from CCList inner join CCThemes on ... but you are not using any aggregate operators ... explain what you're trying to accomplish. ...
    (microsoft.public.sqlserver.programming)