度量快速开发平台-专业、快速的软件定制快开平台
标题:
用sql计算ABCDE*4=EDCBA(这五个数字不重复)
[打印本页]
作者:
张兴康
时间:
2020-7-26 14:03
标题:
用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
复制代码
作者:
陈晓龙
时间:
2020-7-26 15:38
又整这些高级东西了哦!
作者:
张兴康
时间:
2020-7-28 09:41
万望 发表于 2016-2-28 23:53
我也是说,大牛
作者:
陈晓龙
时间:
2020-7-28 16:07
万望 发表于 2016-2-28 23:53
我也是说,大牛
这娃儿厉害吧!
作者:
万望
时间:
2020-7-28 23:53
陈晓龙 发表于 2016-2-26 15:38
又整这些高级东西了哦!
我也是说,大牛
欢迎光临 度量快速开发平台-专业、快速的软件定制快开平台 (http://bbs.delit.cn/)
Powered by Discuz! X3.2