在MySQL中按日期排序 [英] Sorting by Date in MySQL

查看:119
本文介绍了在MySQL中按日期排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每一天都很美好...


我对这些东西感到困惑......关于如何按照月份的顺序排序,以及稍后的日期... <这里是代码:


[PHP] $ sql =" SELECT * FROM $ sched ORDER BY date;" ;; [/ PHP]


infact它会按字母排列排序...我的观点是,怎么可以排序这种日期ei:2007年5月5日到2007年12月30日在我的编码中,第一个月下降到上个月?


的结果,这里是链接:时间表


任何人都可以帮我解决这个问题吗?

good day every one...

im kinda confused about this stuff... on how to sort it by in order of Month and later on the Date...

here''s the code:

[PHP]$sql="SELECT * FROM $sched ORDER BY date;";[/PHP]

infact it will sort it in alphabetical arrangement... my point is, how the hell can sort this kind of Date "ei: May 5, 2007 up to December 30, 2007" in my coding where the first month descending to last month?

for the result, here''s the link: Schedule

anyone can help me about this stuff?

推荐答案

sql =" SELECT * FROM
sql="SELECT * FROM


sched ORDER BY date;" ;; [/ PHP]


infact它将按照字母顺序排列......我的观点是,到底如何排序这种日期ei:2007年5月5日至2007年12月30日在我的编码中,第一个月下降到上个月?


的结果,这里是链接:时间表


任何人都可以帮我解决这个问题吗?
sched ORDER BY date;";[/PHP]

infact it will sort it in alphabetical arrangement... my point is, how the hell can sort this kind of Date "ei: May 5, 2007 up to December 30, 2007" in my coding where the first month descending to last month?

for the result, here''s the link: Schedule

anyone can help me about this stuff?


Heya ,imarkdesigns。


我很惊讶MySQL没有抱怨该查询,因为''date''是一个保留字(你可以用它作为列名,但你通常必须用反引号括起来,例如'date`)。


你的'date`栏是什么类型的?
Heya, imarkdesigns.

I''m surprised that MySQL doesn''t complain about that query since ''date'' is a reserved word (you can use it as a column name, but you must generally enclose it in backticks, e.g., `date`).

What type is your `date` column?


这篇关于在MySQL中按日期排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆