Senin, 16 September 2019

[MS_AccessPros] Combine 2 queries into one question

 

Hello all,

I have 2 queries that make a table that gets the max of an id and last balance in a table. I find it difficult to understand why I cannot do this in one query. The first query is a select query that gets the max of the id in the PSS DATA table. Below are the sql statements. Is there a way to combine these queries into one? I have tried the below under Query1 but it does not give me the last balance. I do get a balance but it is a balance 5 records from the last record. and the max Id is correct just not the last balance

Thank You

Jim Wagner

Query1

SELECT Last([PSS DATA].BALANCE) AS LastOfBALANCE
FROM [PSS DATA];



CURRENT PROCESS

qry_updateBegBalance1

SELECT Max([PSS DATA].ID) AS MaxOfID
FROM [PSS DATA];

The second query is a make table that uses the the qry_updateBegBalance1 query and the PSS DATA table to make a table named tempBalanceTotal.

qry_updateBegBalance2

SELECT [PSS DATA].BALANCE INTO tempBalanceTotal
FROM qry_updateBegBalance1 INNER JOIN [PSS DATA] ON qry_updateBegBalance1.MaxOfID = [PSS DATA].ID;


__._,_.___

Posted by: luvmymelody@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar