下面是一个 sql 语句和我收到的错误。我已经包含了两个表中所有可能的字段,有什么问题?我想按 prodID 对所有返回的项目进行分组
列 'orders.adminStatus' 在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中
SELECT TOP 20
ADMINSTATUS, CURRENCY, CUSTOMERID, CUSTOMERMESSAGE, DELTIME, DELTOTAL, DISCOUNT, DISCOUNTCODE,
IP, ITEMDES, OPTIONS, ORDEREDID, ORDERTOTAL,
oi.ORDER_ID, o.ORDER_ID, PAYMENTTYPE, PPRICE, PRODID, QTY, REASON, SECURITYKEY, SHIPADDRESS1,
SHIPADDRESS2, SHIPADDRESS3, SHIPCITY, SHIPCOMPANY,
SHIPCOUNTRY, SHIPCOUNTY, SHIPMETHOD,
SHIPNAME, SHIPPOSTCODE, STATUS, STOCKCODE, SUBTOTAL, TAX, TAXABLE, TIMEDATE, TXAUTHNO, VENDORTXCODE, VPSTXID
FROM orderedItems oi
left join orders o on oi.order_id = o.order_id
Group by PRODID