Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining 2 Queries

Status
Not open for further replies.

nancier

MIS
Dec 27, 2004
50
US
I have 2 queries. The first query gives a square root calculation number and the second query gives a running sum of that number. I'm wondering if the two queries below could be combined into one. Thanks to anyone who can help!!!

Query1
SELECT [Begin] & " To " & [End] AS Range, Count(tblAmount.ID) AS Records, Sum(tblAmount.Amt) AS Dollars, tblStrataRange.Diff, Sqr([Diff]*[Records]) AS Expr1, tblStrataRange.ID
FROM tblAmount, tblStrataRange
WHERE (((Abs([Amt])) Between [Begin] And [End]))
GROUP BY [Begin] & " To " & [End], tblStrataRange.Diff, tblStrataRange.ID, tblStrataRange.Begin
ORDER BY tblStrataRange.Begin;

Query2
SELECT A.Records, A.Range, Sum(B.Expr1)
FROM sqryRangeCount AS A INNER JOIN sqryRangeCount AS B ON A.ID>=B.ID
GROUP BY A.Range, A.ID, A.Records, A.Expr1
ORDER BY A.ID;
 
what do you mean with "combine" ? what fields do you want to see ?
 
I wanted to get a running sum of the Sqr([Diff]*[Records]) AS Expr1 but in the same query and eliminate Query2. The more I think about it though, It's probably not possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top