this.systemService.findForJdbc(sql, page, rows); sql = "select.........ORDER BY UNIX_TIMESTAMP(create_date) DESC ",这里 DESC 没有作用,任然按create_date asc排序输出,如何解决这个问题?
经过debug,发现 ,类比为下面:
SELECT id , mobilePhone ,create_date from t_s_user order by create_date desc; SELECT id , mobilePhone ,create_date from t_s_user order by create_date asc; 输出的数据按照创建日期排序正常。
[org.hibernate.SQL:104]query 会把sql 包含在SELECT * FROM ( sql ) as sel_tab00 limit 0,100
如同下面:
SELECT * FROM (SELECT id , mobilePhone ,create_date from t_s_user order by create_date ASC) as tsu limit 0,100; SELECT * FROM (SELECT id , mobilePhone ,create_date from t_s_user order by create_date DESC) as tsu limit 0,100;
输出的都是按照创建时间升序排列。asc正常, desc根本不起任何作用,还是按照ASC排序。
何解??
|