select top 10 idx, subject, contents, regdate, writer, category, viewcount, openYN, mainYN from ma_data_table where 1=1 and openYN='Y' and idx not in (select top 40 idx from ma_data_table where 1=1 and openYN='Y' order by seq desc, regdate desc, idx desc) order by seq desc, regdate desc, idx desc