Hello,
I am looking for a query to select the second highest value (in this case a date) from a table.
For example, if I had the following dates:
9/1/06
9/2/06
9/3/06
9/4/06
I would want the results of my query to be 9/3/06.
My table is called tblEquityFunds and the field I'm looking to select is called Added. I have the following query, which I think works, but it seems like an awfully goofy way to do it:
Is there a more elegant solution?
I am looking for a query to select the second highest value (in this case a date) from a table.
For example, if I had the following dates:
9/1/06
9/2/06
9/3/06
9/4/06
I would want the results of my query to be 9/3/06.
My table is called tblEquityFunds and the field I'm looking to select is called Added. I have the following query, which I think works, but it seems like an awfully goofy way to do it:
Code:
SELECT DISTINCT TOP 2 Max(tblEquityFunds.Added) AS MaxOfAdded
FROM tblEquityFunds
WHERE tblEquityFunds.Added Not In (Select Max(Added) FROM tblEquityFunds))
Is there a more elegant solution?