-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* and then Victoria Reznichenko declared....
> NW> I've been searching for a solution to the following:
> 
> NW> Is there an easy way to order by date (YYYY - MM - DD), at the moment my
> NW> results are coming back with the *day* ordered but not the whole date
> NW> like this:
> 
> NW> 02 02 2002
> NW> 03 03 2005
> NW> 18 02 2003
> 
> NW> See what I mean?
> 
> What is your column type? Why you don't use ORDER BY your_date_column
> in the SELECT statement? It should work, but I can say you exactly
> because I don't know your table structure. The other causes of wrong
> result might be that something is not correct in your SQL statement.

Right. here is the db schema: Feel free to berate me if I'm missing the
obvious :-)
CREATE TABLE iaadiplom_timetable 
(
    id INT NOT NULL AUTO_INCREMENT, 
    module ENUM('0', '1', '2', '3', '4', '5'), 
    week VARCHAR(255) NULL,  
    date DATE NOT NULL, 
    ektione VARCHAR(255) NULL, 
    title TEXT NULL, 
    teacher_id INT NULL, 
    PRIMARY KEY(id)
)

and here is my select:

        $qry="SELECT id, module, week, ";
        $qry.="DATE_FORMAT(date, \"%d %m %Y\") as date, ";
        $qry.="ektione, title, teacher_id ";
        $qry.="FROM $this->table ";
        $qry.="WHERE module = '$module' ";
        $qry.="ORDER BY date ASC";


Thanks very much for the help!
- -- 
Nick Wilson     //  www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE819AVHpvrrTa6L5oRAtj2AJ9CFMVEZEyBZKxy7zhOoSmMDAWUrwCfelhu
UbSqDCWAxbYSgmGA2/u6OL8=
=qD2+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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

Reply via email to