Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 13th, 2002, 10:57 PM
Sgt_USMC Sgt_USMC is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 Sgt_USMC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to Sgt_USMC
Most Recents Dates

Hey everybody...

Please help! I'm at a sticking point. Sorry I can't provide a URL as this is on an intranet.

What I'm trying to accomplish:

Getting the most recent announcements from a newsletter organized by date. There are several announcements to one date.

As people submit announcements.. How do you write the SQL properly to show only the latest group of announcements. I cannot hard code a date or filter by date as the dates change. Just need the group of MOST RECENT announcements.

Table title: Announcements
Fields are:
1. date_id <<< the date column
2. Title <<< the title of the record
3. Body <<< the main text body
4. id <<< Autonumber

Right now I have been to figure out is to sort by date and have ALL showing

SELECT *
FROM Announcement
ORDER BY date_id DESC

Reply With Quote
  #2  
Old November 14th, 2002, 01:32 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Most Recents Dates

Well, it depends on what database system you are using..if it is MySQL, use the LIMIT functionality:

SELECT *
FROM Announcement
ORDER BY date_id DESC
LIMIT 10

That would limit the results to 10.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Most Recents Dates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT