不同的結果,我有這樣的:集團通過給出SQL
SELECT ([Document No_])
FROM [Verploegen POC$Sales Line]
--WHERE [Shipment Date] = '2014-05-08'
GROUP BY [Document No_]
--[Shipment Date]
--[Document No_],
HAVING COUNT(*) > 1
,給我272160個返回結果。
,但如果我這樣做:
SELECT ([Document No_]), [Shipment Date]
FROM [Verploegen POC$Sales Line]
--WHERE [Shipment Date] = '2014-05-08'
GROUP BY [Document No_], [Shipment Date]
--[Shipment Date]
--[Document No_],
HAVING COUNT(*) > 1
返回:267661.
怎麼可能?
謝謝
如果我這樣做:
SELECT ([Document No_]), [Shipment Date]
FROM [Verploegen POC$Sales Line]
WHERE [Shipment Date] = '2012-01-01'
我得到36個返回結果。但有雙打,像這樣:
V004180 2012-01-01 00:00:00.000
V004182 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
V066594 2012-01-01 00:00:00.000
所以我試圖剔除有雙打的雙打。但是,在這種情況下,如何返回帶有標題的樹結果(即唯一值):文檔No_和裝運日期?
謝謝
如果我這樣做:
SELECT ( [Document No_]), [Shipment Date], COUNT(*) as count
FROM [Verploegen POC$Sales Line]
WHERE [Shipment Date] = '2012-01-01'
GROUP BY [Document No_], [Shipment Date]
SELECT ( [Document No_]), COUNT(*) as count
FROM [Verploegen POC$Sales Line]
WHERE [Shipment Date] = '2012-01-01'
GROUP BY [Document No_]
它會返回完全相同的結果
erm ...因爲它們是不同的查詢?! – Tanner
但我只是添加爲標題出貨日期。所以我想顯示文件No_和裝運日期。 –
好吧,我們不知道你的數據是什麼樣的,但是如果你有不同的分組和額外的列,你很可能會看到不同數量的結果。 – Tanner