NutzCN Logo
问答 上面的自定义SQL查询数量正确,下面的查询数量不正确?
发布于 2542天前 作者 shusheng 1720 次浏览 复制 上一个帖子 下一个帖子
标签:
{
			Sql sqlRoleIds = Sqls.create("select topicid from $table $condition");
			sqlRoleIds.vars().set("table", "t_forum_reply");
			sqlRoleIds.setCondition(Cnd.where("userId", "=", user.getId()).groupBy("topicid"));
			sqlRoleIds.setCallback(Sqls.callback.strList());
			dao.execute(sqlRoleIds);
			List<String> topicIds = sqlRoleIds.getObject(List.class);
			createPager.setRecordCount(topicIds.size());
		}
int count = dao.count("t_forum_reply",Cnd.where("userId", "=", user.getId()).groupBy("topicid"));
		createPager.setRecordCount(count);
2 回复

输出的sql有啥差异

sql=select topicid from t_forum_reply  WHERE userId=44 GROUP BY topicid 
sql=SELECT COUNT(*) FROM t_forum_reply  WHERE userId=44 GROUP BY topicid 
添加回复
请先登陆
回到顶部