Person Date
p1 null
p1 05/22/2000
p1 05/21/2000
p2 08/03/2000
p2 08/02/2000
p2 08/01/2000
p3 08/20/2000
p4 null
p4 02/01/2001
如何查詢這個結果,我會排除那些人'p'
其最新的日期是NULL
當p1
在其最新的日期null
一樣,P1不應該在顯示結果列表與p4
相同。我知道一個簡單的Where clause
將無法與這一個,因爲它只會刪除p1
與null
值。我甚至用WHERE MAX(DATE) <> ''
嘗試,但它給了我錯誤:只顯示的ID,其中最新的日期不是空
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference
如何知道最新日期,如果它是NULL? –
顯示您的數據的預期結果 –
您想要排除所有至少有一個記錄帶有'null'日期的人,對嗎? –