Вопрос про Mssql
попробуй...
insert into #a (TotalAmount, PaperID) select * from (
select sum(#t.Amount #t.PaperID from #t where #t.paperid is not null group by #t.PaperID
)
insert into #a (TotalAmount, PaperID) select * from (
select sum(#t.Amount #t.PaperID from #t where #t.paperid is not null group by #t.PaperID
)
внутренний селект выступает как subquery. та жа самая ошибка
на SQL Server 2005 твой пример ошибки не выдает
да блин таблицу забыли дропнуть
все вопрос закрыт
все вопрос закрыт
Оставить комментарий
laki
create table #t(
Amount int,
DT datetime,
PaperID int,
OptionType int,
FuturePrice numeric(18, 6
Strike numeric(18, 6
TimeToEnd numeric(18, 6
RiskFreeRate numeric(18, 6
Premium numeric(18, 6)
)
create table #a
(
TotalAmount int,
PaperID int
)
insert into #a (TotalAmount, PaperID)
select sum(#t.Amount #t.PaperID from #t where #t.paperid is not null group by #t.PaperID)
Выдает ошибку:
Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
Как это альтернативно решить?