union top n 가져오기

select top 8 -- 상위 8개만 가져올때 사용합니다.

b_index, b_subject, b_date, b_xgg, b_xd

from (

select b_index, b_subject, b_date, b_xgg, b_xd from a where b_xgg='1'

union all

select b_index, b_subject, b_date, b_xgg, b_xd from b where b_xgg='1'

union all

select b_index, b_subject, b_date, b_xgg, b_xd from c where b_xgg='1'

union all

select b_index, b_subject, b_date, b_xgg, b_xd from d where b_xgg='1'

) a

order by b_index desc<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:27:00 MySQL에서 이동 됨]</div>
|

댓글 1개

top 8은 M$SQL에서 가능합니다.

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고