select distinct df1.id,df1.name,sum(df2.num1)-sum(df2.num2) 数量,sum(df3.na1) 金额 from df1,df2,df3 where df1.id=df2.id and df1.id=df3.id group by df1.id,df1.name
这个语句在执行时,当表df2的记录id字段相同的记录有n条的情况下,sum(df3.na1)就变成了n*sum(df3.na1).
请问前辈,怎么避免在sum(df3.na1)前面*n呢?
谢谢!
运行环境是SQL server 2000.