简体   繁体   English

mysql按视图排序,然后按id desc排序这些结果

[英]mysql order by views then order these result by id desc

i want to order by views desc then by id desc i've tried 我想order by views desc然后按id desc order by views desc

ORDER BY `id` DESC , `views` DESC 

and

ORDER BY `views ` DESC , `id` DESC 

it did not gave me the result i need 它没有给我我需要的结果

i want to get the most recent news by views 我想通过视图获取最新消息

table news
id int(11)|views int(11)

any help please 任何帮助请

然后在子句中按正确的顺序放置变量:

ORDER BY `views` DESC, `id` DESC 

then use the order views first and then id. 然后先使用订单视图,然后再使用ID。

try this 尝试这个

   ORDER BY  `views` DESC ,`id` DESC 

我认为语法通常是ORDER BY id,查看DESC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM