我的代码是这样的,有两个sql语句公用一段条件,但是两个sql语句中有一个列冲突了
Dao dao = dbTools.getDao();
Cnd cnd = Cnd.where("terminal_id", "=", did).and("year(day)", "=", year).and("month(day)", "=", month);
mileage = dao.execute(Sqls.fetchDouble("select sum(kilometers) from biz_dev_kilometers $condition").setCondition(cnd)).getObject(Double.class);
charge = dao.execute(Sqls.fetchDouble("select sum(charge) from biz_dev_kilometers $condition").setCondition(cnd)).getObject(Long.class);
Cnd cnd1 = cnd;
run_days = dao.count("biz_dev_kilometers", cnd1.and("kilometers", ">", 0));//月度运行天数
Cnd cnd2 = cnd;
stop_days = dao.count("biz_dev_kilometers", cnd2.and("kilometers", "=", 0));//月度停驶天数
最终导致stop_days计算错误,因为sql语句变成了
AND kilometers>0 AND kilometers=0"
把上一个条件也给添加进去了。。。怎么破