Mysql按不同日期排序

时间:2017-05-11 19:18:09

标签: mysql sql-order-by

consider

  

考虑表格,我想要一个订单,其中包含最新的编辑日期   billno排在最前面,等等。就像在这种情况下billno 11有   最新的edit_date所以所有billno 11条目都排在最前面。如果是另一个   billno拥有最新的edit_date然后该billno的所有条目都来了   在顶部。

2 个答案:

答案 0 :(得分:0)

select id, billNo, amount, edit_date
from [whatever tables and join conditions you need here]
order by edit_date desc

答案 1 :(得分:0)

这是我想要的最终查询,我终于明白了。 enter image description here