求助一条sql查询
SELECT a.productname, a.containername, a.specname, a.moveinqty, a.moveoutqty
FROM aaa a, bbb b
WHERE a.moveouttimestamp IS NOT NULL
AND a.specname IN
( '6010 ', '7010 ', '7020 ', '7030 ', '7040 ', '7050 ', '7060 ', '7070 ')
AND a.containername IN (SELECT containername
FROM aaa)
AND a.productname = b.productname
AND b.cdoname = 'TrackOutLot '
AND b.txndate =
(SELECT MAX (b.txndate)
FROM aaa a, bbb b
WHERE a.moveouttimestamp IS NOT NULL
AND a.specname IN
( '6010 ',
'7010 ',
'7020 ',
'7030 ',
'7040 ',
'7050 ',
'7060 ',
'7070 '
)
AND a.containername = b.containername
AND a.productname = b.productname
&nbs