Views 33921 Votes 0 Comment 1
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

기본적인 쿼리

select distinct * from 테이블명;


distinct * 이란건 한 행의 전체 칼럼값이 중복되는 데이터를 제거하고 뽑아냄..


예를 들어 중복된걸 제거한 제목을 뽑아 낼려면..

select distinct 제목 from 테이블명;;


전체 칼럼을 뽑아 내는데 중복된게 제목이 중복된건 하나만 출력하고 싶다면 index값이 있어야 함.

select * from 테이블명 where index in (select max(index) from 테이블명 group by 제목)


그리고 정렬은..

select * from 테이블명 where index in (select max(index) from 테이블명 group by 제목) order by 제목


만약 index값이 없다면 unique한 값으로 조건을 줘도 됨..


?

List of Articles
No. Category Subject Author Date Views
154 System/OS [linux] yum 업데이트 시 커널 제외하기 hooni 2014.09.11 1258
153 System/OS [linux] resolv.con 초기화 되는 문제 hooni 2014.04.05 4616
152 System/OS [linux] CentOS 6.5 에서 "Bringing up interface eth0: Determining if ip address 121.78.127.197 is already in use for device eth0..." hooni 2014.04.05 4839
151 System/OS [mac] 맥(OSX)에서 NTFS, 윈도우에서 HFS+ 사용하기 file hooni 2014.03.12 5117
150 System/OS [mac] 맥OSX에서 NTFS 쓰기 기능 활성화 hooni 2014.03.12 4286
149 System/OS HTTPS와 SSL 인증서 file hooni 2014.03.11 7546
148 System/OS [linux] split 명령어 hooni 2014.03.11 4305
147 System/OS [linux] awk 명령어 hooni 2014.03.11 4955
146 System/OS [linux] 쉘스크립트 expr hooni 2014.03.11 15618
145 System/OS [linux] CentOS Apache Httpd에 https 적용 hooni 2014.03.05 4480
144 System/OS [linux] CentOS 6.x Cati 설치 (yum) hooni 2014.01.17 48594
143 System/OS [linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기 file hooni 2014.01.09 12219
142 System/OS [linux] root 전환시 패스워드 없이 su 사용하기 hooni 2013.12.22 12685
141 System/OS [linux] CentOS 터미널 언어 설정(한글/영어) hooni 2013.12.22 18513
140 System/OS CentOS 6.5 USB 설치 6 file hooni 2013.12.18 37676
139 System/OS [mac] Charlesproxy 간단한 설정 내용~ hooni 2013.11.12 12325
Board Pagination Prev 1 2 3 4 5 6 ... 13 Next
/ 13