If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > query by recent dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-04, 12:26
-Dman100- -Dman100- is offline
Registered User
 
Join Date: Jan 2004
Posts: 124
query by recent dates

How would I construct a SQL statement that would query the database and return the 5 most recent dates added into the database?

Would I use the TOP SQL keyword to select the 5 most recent entries?

How would I query for the most recent dates?

SELECT TOP 5 *
FROM dbo.tblWeblog
WHERE blogDate = ?

Thanks for any help!
-Dman100-
Reply With Quote
  #2 (permalink)  
Old 09-15-04, 12:30
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Close! I'd use:
Code:
SELECT TOP 5 *
   FROM dbo.tblWeblog
   ORDER BY blogDate DESC
-PatP
Reply With Quote
  #3 (permalink)  
Old 09-15-04, 14:26
-Dman100- -Dman100- is offline
Registered User
 
Join Date: Jan 2004
Posts: 124
Thanks Pat!
-Dman100-
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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