「SQL」 distinct文で指定項目の重複行を非表示にする
書式
select distinct 項目名 from テーブル名
select distinct 項目名1,項目名2,xxx from テーブル名
使用例1
select distinct
FirstName
from
employees
where
FirstName = "Nancy";
結果
| FirstName |
|---|
| Nancy |
使用例2
select distinct
employeeid
, firstname
, birthdate
from
employees
where
FirstName = "Nancy";
結果
| EmployeeID | FirstName | BirthDate |
|---|---|---|
| 1 | Nancy | 1968-12-08 |