MySQL (非存储过程)解决易语言难题
发布时间:2021-01-14 09:24 所属栏目:[水果奶奶论坛] 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 drop table if exists n1;create temporary table n1(num int (1));insert into n1 values(1),(2),(3),(4),(5),(6),(7),(8),(9);drop table if exists
以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 drop table if exists n1; create temporary table n1(num int (1)); insert into n1 values(1),(2),(3),(4),(5),(6),(7),(8),(9); drop table if exists n2; create temporary table n2 select * from n1; drop table if exists n3; create temporary table n3 select * from n1; drop table if exists nums1; create temporary table nums1 select n1.num * 100 + n2.num * 10 + n3.num as num from n1 left join n2 on n1.num <> n2.num left join n3 on n1.num <> n3.num and n2.num <> n3.num; drop table if exists nums2; create temporary table nums2 select * from nums1; drop table if exists nums3; create temporary table nums3 select * from nums1; select * from nums1 as n1 left join nums2 as n2 on n1.num <> n2.num left join nums3 as n3 on n1.num <> n3.num and n2.num <> n3.num where n1.num * 2 = n2.num and n1.num * 3 = n3.num and n1.num not rlike concat("[",n2.num,"]") and n1.num not rlike concat("[",n3.num,"]") and n2.num not rlike concat("[","]"); drop table if exists n1; drop table if exists n2; drop table if exists n3; drop table if exists nums1; drop table if exists nums2; drop table if exists nums3; 结果: mysql> select * -> from nums1 as n1 left join nums2 as n2 -> on n1.num <> n2.num -> left join nums3 as n3 -> on n1.num <> n3.num and n2.num <> n3.num -> where n1.num * 2 = n2.num and n1.num * 3 = n3.num -> and n1.num not rlike concat("[","]") -> and n1.num not rlike concat("[","]") -> and n2.num not rlike concat("[","]"); +------+------+------+ | num | num | num | +------+------+------+ | 192 | 384 | 576 | | 219 | 438 | 657 | | 273 | 546 | 819 | | 327 | 654 | 981 | +------+------+------+ 4 rows in set (0.03 sec) 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。 |
相关内容
网友评论
推荐文章
-
今天PHP站长网 52php.cn把收集自互联网的代码分享给大...[详细]
-
sql-server – Microsoft SQL Server的拥有架构和角色成员资格之
自有架构和角色成员之间是否存在差异? 根据我的理解,...[详细]
-
我做了一些研究,发现我应该将路线存储为一系列停靠点....[详细]
-
今天PHP站长网 52php.cn把收集自互联网的代码分享给大...[详细]
-
我正在做一些基于员工工作时间的报告.在某些情况下,数...[详细]
-
我想在数据库中使用两个不同的模式,每个模式具有相同...[详细]
-
今天PHP站长网 52php.cn把收集自互联网的代码分享给大...[详细]
-
Symfony2(WebsocketBundle) – 简单的私有(和组)聊天数据库模式
我想在一个网站上实现一个非常简单的聊天,在2个注册用...[详细]
-
今天PHP站长网 52php.cn把收集自互联网的代码分享给大...[详细]
-
我有一个SQL Server 2012数据库.我注意到一些查询提前...[详细]
热点阅读