Hello,
I have a tbl with the following fields:
Acct_Num, Mkt_Dt,Cash_Value
The table holds every daily ending balance since it was opened. I am trying to run a query to capture the "MAX" mkt_dt so that I have the most recent value as of yesterdays close.
When I run a straight Max(mkt_dt) in the design view of the query it returns every row in the table. If the market value changes, which it does, then the query is pulling the "max" date for every value change.
I think I am able to get the true max date if I use a sub-query within the where criteria of the mkt_dt field.
This is what I have so far.....I have tried all types of combinations. Do you see anything wrong with my syntax??
I have a tbl with the following fields:
Acct_Num, Mkt_Dt,Cash_Value
The table holds every daily ending balance since it was opened. I am trying to run a query to capture the "MAX" mkt_dt so that I have the most recent value as of yesterdays close.
When I run a straight Max(mkt_dt) in the design view of the query it returns every row in the table. If the market value changes, which it does, then the query is pulling the "max" date for every value change.
I think I am able to get the true max date if I use a sub-query within the where criteria of the mkt_dt field.
This is what I have so far.....I have tried all types of combinations. Do you see anything wrong with my syntax??
PHP:
Select * From tbl1 where PGM = "TEST" and Mkt_Val = (select Acct_Num,max(mkt_dt) From tbl1);
Last edited: