Click here to Skip to main content
15,885,920 members

Comments by Nitin20TechBLR (Top 1 by date)

Nitin20TechBLR 18-Oct-13 2:16am View    
No we cannot have a check of statusId at last statement as SalesAmount which depends on statusID is calculated at upper queries, The only problem is that we need to have some condition at the last statement so that it wont sums up other heirarichy salesAmount

select sum( OSA1.OwnSaleAmount )
from tblTotalOwnSaleAmount OSA1
where OSA1.UserId > OSA.UserId ---- here require some condition