728x90
Query한 결과를 다시 Query하는 방법
SELECT * FROM (SELECT * FROM [테이블] WHERE [조건문]) AS [새로운 테이블 이름] WHERE [조건문]
예제
Table : member
id | age | sex |
A | 10 | female |
B | 14 | female |
C | 20 | male |
D | 25 | male |
E | 40 | female |
F | 11 | male |
SELECT * FROM (SELECT * FROM member WHERE age>12) AS new_member WHERE sex ='female'
id | age | sex |
B | 14 | female |
E | 40 | female |
728x90
댓글