Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get my GROUP BY clause to work
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Can't get my GROUP BY clause to work
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01255597
Message ID:
01255597
Vues:
66
I'm getting this error on my select statement: "Msg 164, Level 15, State 1, Line 12
Each GROUP BY expression must contain at least one column that is not an outer reference."

Here is the statement - anyone see my problem? been driving me nuts all day!

INSERT INTO #SummarizedData1(
ControlDateKey,
ActualDateKey,
ControlPeriodStartKey,
ControlPeriodEndKey,
Store,
Units,
Sales,
Markdown)

SELECT CYDateKey = @FlashControlDateKey,
dbo.FlashData_CurrentYear.FDAT,
PeriodStartKey = @FlashControlPeriodStartKey,
PeriodEndKey = @FlashControlPeriodEndKey,
dbo.FlashData_CurrentYear.FSTR,
SUM(dbo.FlashData_CurrentYear.FQTY) AS Units,
SUM(dbo.FlashData_CurrentYear.FSLS) as Sales,
SUM(dbo.FlashData_CurrentYear.FMKD) as MarkDown
FROM dbo.FlashData_CurrentYear
where dbo.FlashData_CurrentYear.FDAT >= @FlashControlPeriodStartKey
AND dbo.FlashData_CurrentYear.FDAT <= @FlashControlPeriodEndKey
group by @FlashControlDateKey,dbo.FlashData_CurrentYear.FDAT,
@FlashControlPeriodStartKey, @FlashControlPeriodEndKey,
dbo.FlashData_CurrentYear.FSTR
select * from #SummarizedData1
ICQ 10556 (ya), 254117
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform