syat #7691(2008/09/21 01:50 GMT) [ SQL ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
-- 数字テーブル create table d ( n integer, p2 integer, p3 integer, p5 integer ); insert into d values (0,1,1,1); insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; insert into d select max(n)+1, max(p2)*2, max(p3)*3, max(p5)*5 from d; -- 結果テーブル create table result ( id integer primary key, i integer, j integer, k integer, val integer ); insert into result (i, j, k, val) select a.n, b.n, c.n, a.p2 * b.p3 * c.p5 val from d a, d b, d c order by val; select val,'2^'||i||' * 3^'||j||' * 5^'||k from result where id <= 100;
Rating0/0=0.00-0+
1 reply [ reply ]
syat
#7691()
[
SQL
]
Rating0/0=0.00
SQLiteで100行だけ取り出す方法がわからなかったので結果テーブルに一度格納してます。Oracleだとwhere rowno<=100が使えたような
Rating0/0=0.00-0+
1 reply [ reply ]