Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

sorting recordset by date

 
   Web Hosting and Web Master Forums (Home) -> Webmaster RSS
Next:  chroot each domain  
Author Message
iamedia

External


Since: Jan 20, 2005
Posts: 4



(Msg. 1) Posted: Thu Jan 27, 2005 8:35 am
Post subject: sorting recordset by date
Archived from groups: alt>www>webmaster (more info?)

SELECT *
FROM for_sale
ORDER BY ListDate Desc



I want to limit it to last 7 days. How would the SQL be written for Access?

 >> Stay informed about: sorting recordset by date 
Back to top
Login to vote
neilr1

External


Since: Oct 14, 2004
Posts: 17



(Msg. 2) Posted: Thu Jan 27, 2005 8:35 am
Post subject: Re: sorting recordset by date [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"I Need Help!" <iamedia DeleteThis @hotmail.com> wrote in message
news:ctambd$2rcf$1@otis.netspace.net.au...
 > SELECT *
 > FROM for_sale
 > ORDER BY ListDate Desc
 >
 >
 >
 > I want to limit it to last 7 days. How would the SQL be written for
 > Access?


Should be worth Googling for SQL+RANGE

Neil<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: sorting recordset by date 
Back to top
Login to vote
spam19

External


Since: May 08, 2004
Posts: 952



(Msg. 3) Posted: Thu Jan 27, 2005 9:15 am
Post subject: Re: sorting recordset by date [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

And lo, I Need Help! didst speak in alt.www.webmaster:

 > SELECT *
 > FROM for_sale
 > ORDER BY ListDate Desc
 >
 > I want to limit it to last 7 days. How would the SQL be written for
 > Access?

What format is ListDate in? If it's a UNIX epoch timestamp (doubtful if
you're starting with Access), then you can just include a WHERE clause:

SELECT *
FROM for_sale
WHERE ListDate>=UNIX_TIMESTAMP()-604800
ORDER BY ListDate Desc

Otherwise, it's time to do some googling for the Date and Time functions
you have available in Access.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollory that nothing is ridiculous.
- <a style='text-decoration: underline;' href="http://www.greywyvern.com" target="_blank">http://www.greywyvern.com</a> - Orca Knowledgebase: Completely CSS styleable
Knowledgebase/FAQ system<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: sorting recordset by date 
Back to top
Login to vote
nospam39

External


Since: Nov 09, 2003
Posts: 131



(Msg. 4) Posted: Thu Jan 27, 2005 2:35 pm
Post subject: Re: sorting recordset by date [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"I Need Help!" <iamedia DeleteThis @hotmail.com> wrote in message
news:ctambd$2rcf$1@otis.netspace.net.au...
 > SELECT *
 > FROM for_sale
 > ORDER BY ListDate Desc
 >
 >
 >
 > I want to limit it to last 7 days. How would the SQL be written for
 > Access?
 >

SELECT *
FROM for_sale

WHERE DateDiff( "d", [ListDate], Int(Now())) ) <= 7

ORDER BY ListDate Desc


I suggest Int(Now()) as the decimal part of Now() represents hours, mins,
sec which you probably don't want<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: sorting recordset by date 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
mySQL newbie question - sorting results - I'm searching a mySQL table for a specific term. I'd like to order the results by how many times the term appears in each record. Is this possible to do with mySQL, or is it better to do it with PHP or something similar? Thanks

[OT] What happened on this date in... - What happened on this date in... 1492?

date ORDER BY - Hi, I'm currently running a sql select statement on a date field which is ordered by the date field in ascending order. It worked fine for the 1st to the 9th of the month but when it output 10th, 11th, 12th etc. it put them before the 1st. So I was..

Date/Time on Sites - Hi, can someone please advise where I can find out how to get an applet or something that can put the time and date on my site. Thanks

Date/Time Standred Formats - What is the standreds for date/time formats, such as %H %n %M %m etc. Do PHP and Perl use the same format as date in shell?
   Web Hosting and Web Master Forums (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]