我正在尝试执行此SQL查询:
select distinct wonum from invreserve where location='01' order by wonum;
如何将其转换为setWhere()查询?我试过了:
invreserveSet.setWhere("(1 = 1) and wonum in (select distinct wonum from invreserve where location='01')");
答案 0 :(得分:2)
使用类似的东西:
select invreserveid from invreserve where invreserveid in (select invreserveid from invreserve invr2 where location like '%B%'
and invreserveid = (select max(invreserveid) from invreserve invr3 where invr3.location = invr2.location and invr3.wonum = invr2.wonum))
;
所以你的where子句与这些子句相同,只是你的位置通配符会有所不同。