按日期排序
SELECT * FROM e_eledata AS a ORDER BY a.DLDT DESC
參考:http://www.cnblogs.com/zsphper/archive/2010/06/10/mysql-group-by-order-by.html
这个文章里提到了怎样让 排序order by和 分组(group by)同一时候使用
排序并去除反复
排序用group by
去除反复用max(expr)
SELECT ed.ID,ed.`NAME`,ed.RATIO,max(e.DLDT),e.TAE,e.TAE/ed.RATIO from e_eledata e , e_elemeterhead ed where e.E_ELEMETERHEAD_ID = ed.ID and ed.`STATUS` = '0' group by ed.ID,ed.`NAME`,ed.RATIO ;