我有一個查詢,低於:錯誤使用ORDER BY和GROUP BY一起
SELECT
o.ordernum,
o.SCHEDATTEMPT,
o.lastcontactdate,
MAX(OE.NextContactDate) AS NextContactDate
FROM orderevents OE
FULL outer join orde_ o
ON o.ORDERID=oe.OrderId
WHERE O.lastcontactdate is not null and SCHEDULED is null and DROPTIME is null
ORDER by O.LASTcontactdate
當我執行此查詢我得到的錯誤Column 'orde_.ORDERNUM' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
。
我在這個查詢中做錯了什麼?
@MitchWheat我怎樣才能解決這個 –