Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 801
  • Last Modified:

How to Sum a Subquery?

I can't seem to sum a subquery where i have some calculated fields in the query itself:

SELECT Count([Payments data].[Job ref]) AS [CountOfJob ref], Sum([Payments data].Comm) AS Commission, Sum([Comm]*0.175) AS VAT, Sum([Comm]+[VAT]) AS Total
FROM [Payments data];

Is this easy to do?

Thanks
lapchien
0
Lapchien
Asked:
Lapchien
1 Solution
 
puranik_pCommented:
SELECT Count([Payments data].[Job ref]) AS [CountOfJob ref], Sum([Payments data].Comm) AS Commission, Sum([Comm])*0.175 AS VAT, Sum([Comm])+sum([VAT]) AS Total
FROM [Payments data];
0
 
nico5038Commented:
Try:

SELECT Count([Payments data].[Job ref]) AS [CountOfJob ref], Sum([Payments data].Comm) AS Commission, Sum([Comm]*0.175) AS VAT, Sum([Comm]+[Comm]*0.175) AS Total
FROM [Payments data];

Nic;o)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now