PHP MySQL 按日和月排序
$query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.'');
月和日在不同的字段,
任何想法,这可能吗?
$query = mysql_query('SELECT * from rbf_edades_news order by month and DESC '.$limit.'');
谢谢!
$query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.'');
month and day are in different fields,
Any idea, is this possible?
$query = mysql_query('SELECT * from rbf_edades_news order by month and DESC '.$limit.'');
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这将首先按月排序,然后按天排序:
This will sort first by month and then by day:
您可以按 2 列排序,例如
you can order by 2 columns like
您可以将 order by 与 2 个字段一起使用。这应该有效:
You can use order by with 2 field. This should work:
不,您的第二个查询不可能。 DESC 必须位于字段名称旁边,如第一个示例中所示,它用于按月份降序排列结果。使用 ASC 进行升序排列。
如果想按天和月排序,可以这样做:
一个问题,$limit变量的内容到底是什么?
No, your second query is not possible. DESC has to be next to a fieldname like in your first example and it is used to order your results by month in descending order. Use ASC for ascending order.
If you want to order by day and month, you can do the following:
One question, what is exactly the content of the $limit variable?