我想要一個查詢來識別具有多個1策略的Vehicle Registration Numbers
,其中Insurance Company ID
的日期重疊。 Check this image for the datasSQL中的重疊日期
SELECT Vehicle_N0.*
FROM excel as Vehicle_N0
WHERE Vehicle_N0 IN (SELECT Vehicle_N0
FROM excel
GROUP BY Vehicle_N0
HAVING COUNT(DISTINCT Insurance_id) > 1)
ORDER BY vehicle_n0
使用此查詢,我得到具有不同Insurance Company ID
但超過1個政策,如何讓重疊的日期Vehicle Registration Numbers
。
我嘗試這個查詢
SELECT *
FROM excel
WHERE begin_date <= end_date
OR begin_date >= end_date;
,但我沒有得到重疊的日期。
請張貼預期結果,實際結果爲文本,而不是圖像 – TheGameiswar
預期的結果是我想要得到的重疊日期從我的桌子上。我試圖做到這一點,但我失敗了 –
看看這個鏈接,以瞭解更多關於如何改善問題:https://spaghettidba.com/2015/04/24/how-to-post-at-sql-question- on-a-public-forum/ – TheGameiswar