Query logic concerning dates
On Thu, 29 Jan 2009 06:16:00 -0800, Joel
wrote:
The command text part of the query is really a SQL command. You really want
to perfrom a filter, sort, and then get the LAST RECORD (not all the
records). I'm not an expert on SQL. A query has a limit number ofn the
number of items to return. You can set this number to 1 and sort backwards
so the last item is the first record.
Maybe this:
SELECT TOP 1 * FROM MyTable WHERE MyDate<=? ORDER BY MyDate DESC;
--
Dick
|