LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dates in SQL query won't match Gustaf Excel Programming 1 April 22nd 08 04:28 PM
How do I export dates into a query? tires85 Excel Discussion (Misc queries) 0 August 11th 06 09:16 PM
How do I use variable dates with a SQL Query MegaWatt Excel Programming 2 May 19th 06 02:25 PM
web query in VBA (format dates in url) slimswol Excel Programming 6 March 11th 06 09:19 AM
dates in query patrick @fizz Excel Worksheet Functions 0 April 8th 05 07:43 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"