|
2007/03/26(Mon) 23:21:11 編集(投稿者) 2007/03/26(Mon) 19:46:43 編集(投稿者)
これでいかが?
SELECT * FROM(SELECT HOGE, ROW_NUMBER() OVER ( ORDER BY HOGE ) RN, max(decode(rowNum,100+1,1,0)) over() as Flag FROM (SELECT HOGE FROM TABLE1 UNION SELECT HOGE FROM TABLE2)) WHERE RN <= 100
もしくは SELECT * FROM(SELECT HOGE, ROW_NUMBER() OVER ( ORDER BY HOGE ) RN, case when count(*) over() > 100 then 1 else 0 end as flag FROM (SELECT HOGE FROM TABLE1 UNION SELECT HOGE FROM TABLE2)) WHERE RN <= 100
もしくは SELECT * FROM(SELECT HOGE, RowNum RN, case when count(*) over() > 100 then 1 else 0 end as flag FROM (SELECT HOGE FROM TABLE1 UNION SELECT HOGE FROM TABLE2 order by hoge) where RowNum <= 100+1) WHERE RN <= 100
わんくま同盟のおっかけ 明智重蔵
なんかやたらとスパムとみなされるのですが
|