0

我正在尝试执行此 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')");

4

1 回答 1

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 子句将与这个相同,除了你的位置通配符会不同。

于 2014-06-25T19:39:46.430 回答