mysql count from子语句需要添加alias

This commit is contained in:
melin
2013-07-29 11:37:29 +08:00
parent 26be569fbc
commit 3dd29c1584
5 changed files with 11 additions and 9 deletions
@@ -323,7 +323,9 @@ public class PagerUtils {
SQLSelectItem countItem = createCountItem(dbType);
countSelectQuery.getSelectList().add(countItem);
countSelectQuery.setFrom(new SQLSubqueryTableSource(select));
SQLSubqueryTableSource fromSubquery = new SQLSubqueryTableSource(select);
fromSubquery.setAlias("ALIAS_COUNT");
countSelectQuery.setFrom(fromSubquery);
SQLSelect countSelect = new SQLSelect(countSelectQuery);
SQLSelectStatement countStmt = new SQLSelectStatement(countSelect);