SELECT DISTINCT
在 SELECT 查詢語句中可使用 DISTINCT 關鍵字過濾重複出現的紀錄值,使用 DISTINCT 關鍵字來限制僅取出欄位中 “不相同” 的值。
Get 烏龜喵’s stories in your inbox
Join Medium for free to get updates from this writer.
若接著 SELECT DISTINCT 後面有指定兩個以上的欄位,則要符合所有選取欄位值皆同樣重複的情況下,該筆資料才會被捨棄不選取。
若只有其中一個欄位值相同但其它欄位值並不同,則仍會取出該筆資料。
參考資料來源:
https://www.fooish.com/sql/distinct.html
https://www.1keydata.com/tw/sql/sqldistinct.html






