| Author |
sorting recordset by date
|
|
| I Need Help! 2005-01-28, 7:43 pm |
| 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?
| |
|
|
"I Need Help!" <iamedia@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
| |
| GreyWyvern 2005-01-28, 7:43 pm |
| 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.
- http://www.greywyvern.com - Orca Knowledgebase: Completely CSS styleable
Knowledgebase/FAQ system
| |
| Martin Harran 2005-01-28, 7:43 pm |
|
"I Need Help!" <iamedia@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
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |