我现在有这样的SQL语句采用分页查询:
SELECT f.id, left(f.film_title, 15) film_title, f.film_poster_path, f.film_year, fdp.update_time film_source_update_time FROM film f LEFT JOIN (SELECT max(optdate) update_time, film_id FROM film_download GROUP BY film_id) fdp ON f.id = fdp.film_id WHERE fdp.update_time IS NOT NULL ORDER BY film_source_update_time DESC;
Model在分页过程中,查询总个数生成totalRowSql:
SELECT count(*) FROM film f LEFT JOIN (SELECT max(optdate) update_time, film_id FROM film_download GROUP BY film_id) fdp ON f.id = fdp.film_id WHERE fdp.update_time IS NOT NULL ORDER BY film_source_update_time DESC
原来使用的是2.2版本,是没有问题的,现在升级到3.0之后系统报错
com.jfinal.plugin.activerecord.ActiveRecordException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'film_source_update_time' in 'order clause'
项目:JFinal