SQL 복잡 조회

5655 단어 sql
최근 에 날짜 가 가장 작은 서로 다른 조건 으로 기록 해 야 하 는 문제 에 부 딪 혔 습 니 다. 여러분 xdjm 의 가르침 을 바 랍 니 다!!  .표 a:
 a: 
                 
1      A  8    2009-12-1 
2      A  9    2009-12-5 
3      B  12    2009-11-18 
4      B  10    2009-11-19 
5      C  5    2009-10-9 
6      C  13    2009-11-8 

원 하 는 결 과 는: 
                 
1      A  8    2009-12-1 
3      B  12    2009-11-18 
5      C  5    2009-10-9 
select *
from tb t 
where not exists(select 1 from tb where   =t.   and     <t.    )
select * from tb a where not exists(select 1 from tb where    =a.   and     <a.      ) 
select *
from tb t
where not exists(select 1 from   =t.   and   <t.  )

 
 

좋은 웹페이지 즐겨찾기