我已经编写了一个sql代码,用于根据给定日期获得项目结算的价值。
SELECT (SELECT Sum(qtyreceived)
FROM purchaseinvoicedetails pid,
purchaseinvoice pi
WHERE itemid_itemid = 1
AND pi.piid = pid.pidetails
AND pi.pidate < Curdate()) - (SELECT Sum(qtysent)
FROM salesinvoicedetails sid,
salesinvoice si
WHERE itemid_itemid = 1
AND si.siid = sid.siid_siid
AND si.sidate < Curdate())
AS
closingstock
返回商品的收盘价值。
我想用hibernate标准实现同样的目标。 我无法弄清楚逻辑。
先谢谢