Re: tweeking WHERE clause
| From: | Daniel Clark | Date: | Wed, 05 May 2004 15:33:58 +0000 |
| Subject: | Re: tweeking WHERE clause | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185437@lists.php.net to get a copy of this message | ||
Hey Melissa.
Will your articles always had a certain number (for each section) each
month? If so a ORDER BY and LIMIT would work.
Daniel
> I am trying to query a table that consists of e-news artilces. in the
> table
> are the following fields: ID, sortBy, datePublished, title, description.
> You can see a fake sample of this at: www.aiaky.org/articles.htm
>
> I have the following $query on the actual e-news page:
>
> $query_rsENews = 'SELECT * FROM NewsArchive WHERE datePublished >=
> DATE_FORMAT(NOW(), "%Y-%m-01") ORDER BY sortBy ASC';
>
> what this is doing is returning only those records whose 'datePublished' =
> the current mont.
>
> it works great...but....there's always a butt......
>
> i really need it to return those records of the most recent date, as the
> most recent date might be last month and there may be no records for this
> month...leaving my page blank. Is there a way to do this?
>
> so many of you have already gotten me to this point...thanks!!!!!!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>