用sql计算ABCDE*4=EDCBA(这五个数字不重复)
--一个五位数字ABCDE*4=EDCBA,这五个数字不重复with a as
(select level - 1 as x from dual connect by level <= 10)
select a.x * 10000 + b.x * 1000 + c.x * 100 + d.x * 10 + e.x as y
from a a, a b, a c, a d, a e
where a.x > 0
and (a.x * 10000 + b.x * 1000 + c.x * 100 + d.x * 10 + e.x) * 4 =
e.x * 10000 + d.x * 1000 + c.x * 100 + b.x * 10 + a.x
and (a.x <> b.x)
and (a.x <> c.x and b.x <> c.x)
and (a.x <> d.x and b.x <> d.x and c.x <> d.x)
and (a.x <> e.x and b.x <> e.x and c.x <> e.x and d.x <> e.x);
with t as
(select level-1 as n from dual connect by level <=10)
select * from t a,t b, t c,t d,t e
where to_number(a.n||b.n||c.n||d.n||e.n)*4= to_number(reverse(a.n||b.n||c.n||d.n||e.n)) and a.n<>0
又整这些高级东西了哦! 陈晓龙 发表于 2016-2-26 15:38
又整这些高级东西了哦!
我也是说,大牛{:2_28:} 万望 发表于 2016-2-28 23:53
我也是说,大牛
{:3_60:} 万望 发表于 2016-2-28 23:53
我也是说,大牛
这娃儿厉害吧!
页:
[1]