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 |
netcamnic
Starting Member
9 Posts |
Posted - 2006-02-16 : 08:31:39
|
I am doing a select and doing a sum in a function .. and of this mistake??someone can help meselect a.dtvcto_doccr as data, b.dt_vcto_doccp as data1, Sum(isnull(dbo.F_CALCULA_SALDO(Max(a.id_doccr),getdate(),isnull(dbo.F_CALCULA_JUROS(Max(a.id_doccr),getdate()), 0),isnull(dbo.F_CALCULA_MULTA(Max(a.id_doccr),getdate()), 0)), 0)) as Saldo,Cannot perform an aggregate function on an expression containing an aggregate or a subquery.regards,Marcos |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-16 : 08:41:38
|
As error indicates sum(max(col)) is not allowedPost some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
|
|
netcamnic
Starting Member
9 Posts |
Posted - 2006-02-16 : 09:02:37
|
Thanks,the results is perfect nowMarcos |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-16 : 09:10:05
|
Post your changed query MadhivananFailing to plan is Planning to fail |
|
|
netcamnic
Starting Member
9 Posts |
Posted - 2006-02-16 : 09:42:28
|
select a.dtvcto_doccr as data, b.dt_vcto_doccp as data1,--a.id_doccr,b.id_doccp, Sum(isnull(dbo.F_CALCULA_SALDO(a.id_doccr,getdate(),isnull(dbo.F_CALCULA_JUROS(a.id_doccr,getdate()), 0),isnull(dbo.F_CALCULA_MULTA(a.id_doccr,getdate()), 0)), 0)) as Saldo, isnull(sum(b.saldo_doccp),0) as saldo_doccp from doccr a full join doccp b on a.dtvcto_doccr = b.dt_vcto_doccp --where a.dtvcto_doccr between @DT_INICIAL-1 and @DT_FINAL+1 --or b.dt_vcto_doccp between @DT_INICIAL-1 and @DT_FINAL+1group by a.dtvcto_doccr,b.dt_vcto_doccporder by a.dtvcto_doccr,b.dt_vcto_doccp |
|
|
|
|
|
|
|