Hi Chris,
On Fri, 2002-06-14 at 02:08, Chris Kay wrote:
>
> I have a rather longer query which I would like to get all records past todays date.
>Here is my query
>
> $ttwo = date("YmdGi");
<snip>
>
>'detail_start_date_y,detail_start_date_m,detail_start_date_d,detail_start_time_h,detail_start_time_m'
> <= '$ttwo'
>
> order by
> detail.detail_start_date_m DESC,
> detail.detail_start_date_d DESC";
If you quote the column names, then MySQL will interprete them as
a string. Also, in this query, you would need to explicitly state the
table that the columns are from.
Also, you will be able to simplify your query by using a datetime
field, instead of separately storing the year, month, day, hour and
minute.
This would reduce the last part of your query down to something
like:
&& detail.start_date <= NOW()
ORDER BY
MONTH(detail.start_date) DESC,
DAY(detail.start_date) DESC;
...
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Zak Greant <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Advocate
/_/ /_/\_, /___/\___\_\___/ Calgary, Canada
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php