1. to_date 直接去掉 例如 select log.id from CM_LOGINLOG log where log.orgid =? and log.isAuto =? and log.userid = ? and log.loginDateTime between to_date(?,'yyyy-mm-dd hh24:mi:ss') and sysdate and rownum=1 " select log.id from CM_LOGINLOG log where log…
之前在一个项目的开发中,有遇到要根据分类来分组获取每组一条按某个条件字段排序的数据结果,于是先自己写了一条语句: select * from `表A` GROUP BY `c`; 上面这个语句有可以根据分类分组获得数据,但是无法对获得的数据进行排序,so 继续完善: select * from `表A` where `del`=0 and `markbok`=1 and `id` in(select SUBSTRING_INDEX(group_concat(`id` order by `add_…
SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, ev…