Contents

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

기본적인 쿼리

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
번호 분류 제목 글쓴이 날짜 조회 수
1113 Develop [c] 파일명 또는 특정 패턴을 적용 file hooni 2016.08.03 758
1112 Develop [Android Error] The number of method references in a .dex file cannot exceed 64K hooni 2016.11.10 760
1111 Develop [linux] CentOS Apache 웹서버에 HTTPS 적용 hooni 2015.10.23 790
1110 System/OS [macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’ file hooni 2022.06.01 794
1109 Develop [io] Apple Watch, Today Extension 앱ID 설정 hooni 2016.04.20 800
1108 Algorithm OCB5 Injection 앗싸뵹! ㅋㅋ file hooni 2014.07.01 804
1107 System/OS [linux] The Ultimate Wget Download Guide With 15 Awesome Examples hooni 2020.05.26 807
1106 Develop [js] e.stopPropagation() VS e.preventDefault () file hooni 2015.04.14 811
1105 Develop [c] 기막힌 정렬 코드 ㅋㄷ file hooni 2015.10.13 814
1104 Develop [android] 초간단 얼럿 (AlertDialog) hooni 2016.10.21 815
1103 Etc 사이버보안실무 수업 메모 hooni 2017.03.30 816
1102 Database [mysql] MySQL 백업 및 복구 hooni 2019.11.22 823
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 98 Next
/ 98