我正在进行查询,以查看我们对特定商品的订单数量。此商品可以有多个商品代码。 我们还想知道此查询中每个订单总共有多少个订单行。
我们现在有:
SELECT
O06T1.deldate, O06T1.ordno,O06T1.ordstat,O06T1.r00key,
O04T90.avemail,O04T90.avphone,
COUNT( O08T1.ordno) AS Orderlines
FROM O06T1
JOIN O08T1 ON O08T1.shorto04 = O06T1.shorto04
JOIN O04T90 ON O04T90.shorto04 = O06T1.shorto04
WHERE
(NOT O06T1.ordstat IN (0,9,25) )
AND (NOT O06T1.ordtype = 11)
AND (
O08T1.partno IN (
'071689000',
'080227000',
'079857000',
'079858000',
'079859000',
'079860000'
)
)
GROUP BY
O06T1.deldate, O06T1.ordno,O06T1.ordstat,
O06T1.r00key,O04T90.avemail,O04T90.avphone
ORDER BY
O06T1.ordno DESC;
O06T1是包含订单的表格。 O08T1是包含所有订单行的表格。
我现在遇到的问题是,根据此查询,我只收到一些订单,这些订单都有1个订单行。但当我查看它们时,它们会发生更多(20-40)的事情?