군침이 싹 도는 코딩

MySQL 유니크 데이터로 만들기 (distinct) 본문

Database/MySQL

MySQL 유니크 데이터로 만들기 (distinct)

mugoori 2022. 12. 7. 11:01
select distinct author_lname 
from books;

# select distinct 컬럼 순으로 쓴다

해당 컬럼의 유니크 데이터만 보여준다

 

 

select distinct concat( author_fname ,' ', author_lname ) as 'full name'
from books;

# distinct는 함수가 아니기때문에 괄호를 사용하지 않는다

다른 함수와 혼용할때도 마찬가지이다