如果要最后5行(以升序排列),则需要一个子查询:
SELECt *FROM ( SELECt id, name, form_id, DATE(updated_at) AS updated_date, updated_at FROM wp_frm_items WHERe user_id = 11 AND form_id=9 ORDER BY updated_at DESC LIMIT 5 ) AS tmpORDER BY updated_at
第10次阅读问题后,这可能是(也许)您想要的。按日期顺序降序,然后按时间(同一日期)升序:
SELECT id, name, form_id, DATE(updated_at) AS updated_dateFROM wp_frm_itemsWHERe user_id = 11 AND form_id=9ORDER BY DATE(updated_at) DESC , updated_at ASC
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)