0

我有这个选择,我需要转换为 linq。我可以通过求和进行普通分组,但我无法在 from 区域内进行选择。

SELECT a.soptype,
   a.sopnumbe,
   b.lnitmseq,
   b.itemnmbr,
   b.itemdesc,
   b.quantity - Isnull(GMCD.mcqty, 0) AS Balance,
   a.custnmbr,
   a.custname
FROM   sop10100 a
   JOIN sop10200 b
     ON a.soptype = b.soptype
        AND b.sopnumbe = a.sopnumbe
   LEFT OUTER JOIN (SELECT soptype,
                           sopnumbe,
                           lnitmseq,
                           Sum(quantity) AS mcqty
                    FROM   mcdetail
                    GROUP  BY soptype,
                              sopnumbe,
                              lnitmseq) AS GMCD
                ON GMCD.soptype = b.soptype
                   AND GMCD.sopnumbe = b.sopnumbe
                   AND GMCD.lnitmseq = b.lnitmseq
WHERE  voidstts = 0
   AND b.itemnmbr = 'TestItem'
   AND b.quantity - Isnull(GMCD.mcqty, 0) > 0 
4

0 回答 0