Forum Moderators: open
I'm constructing a database with a number of files available.
I want the user to be able to organize the files by the dates they were uploaded.
My current select statement only orders by the day and not the month and the year.
How can I order the results of the database taking into account the day, month and year the file was uploaded?
Downloads Table
fname
FileName
created
18/04/2008
category
application
$query="SELECT * FROM Downloads WHERE category='$selcat' ORDER BY created DESC, fname"; There aren't too many entries in the database, I'm just trying to lay out the foundations. I'm happy to change the created field to another format if it makes ordering the results easier... i.e 18/04/08
For clarification, by default does SQL add a hidden date attribute for each entry inserted? Do I really need a "created" field for each file...?
Date and Time Functions [dev.mysql.com]