NutzCN Logo
问答 Cnd.where("name",in,list),sql语句出现 where 1!=1,求去掉1!=1或换成1=1
发布于 2674天前 作者 Nooft 2377 次浏览 复制 上一个帖子 下一个帖子
标签:

//资金来源统计
Sql sql = dao.sqls().create("InvestmentStatistics.sum");
sql.vars().set("fcOrgId",Cnd.where("fc.belong_id","in",list));
sql.vars().set("riOrgId",Cnd.where("ri.org_id","in",list));

select ri.plan_year_project planYearProject from reporting_info ri WHERE 1 != 1 and ri.year = '2017' and ri.month = '1'

6 回复

是 InvestmentStatistics.sum 里面有 1 != 1 吧?

select ( select sum( fs.money ) moneyMonth from funding_source fs left join facility_construct fc on fs.belong_id = fc.id $fcOrgId and fs.input_time < @timeMax and fs.input_time >= @times ) moneyMonth, ( select sum( fs.money ) moneyMonths from funding_source fs left join facility_construct fc on fs.belong_id = fc.id $fcOrgId and fs.input_time < @timeMax and fs.input_time >= @timeMin ) moneyMonths, ( ( select sum( fs.money ) moneyMonth from funding_source fs left join facility_construct fc on fs.belong_id = fc.id $fcOrgId and fs.input_time < @timeMax and fs.input_time >= @times )* 100 /( select ri.plan_year_money planYearMoney from reporting_info ri $riOrgId and ri.year = @year and ri.month = @monthProject ) ) percentageMonth, ( ( select sum( fs.money ) moneyMonth from funding_source fs left join facility_construct fc on fs.belong_id = fc.id $fcOrgId and fs.input_time < @timeMax and fs.input_time >= @timeMin )* 100 /( select ri.plan_year_money planYearMoney from reporting_info ri $riOrgId and ri.year = @year and ri.month = @monthProject ) ) percentageMonths, ( select ri.plan_year_money planYearMoney from reporting_info ri $riOrgId and ri.year = @year and ri.month = @monthProject ) planYearMoney, ( select ri.plan_year_project planYearProject from reporting_info ri $riOrgId and ri.year = @year and ri.month = @monthProject ) planYearProject;

没有

        Sql sql = Sqls.create("select * from t_user $abc");
        sql.vars().set("abc", Cnd.where("id", "in", new int[]{1,2,3}));
        System.out.println(sql.toString());

输出

select * from t_user  WHERE id IN (1,2,3)

并不会有你说的 1 != 1

谢谢了,我去试试。

是因为里面没有值的原因造成的

里面没有值是啥意思?

添加回复
请先登陆
回到顶部