首页 > Web开发 > 详细

ThinkPHP/---union

时间:2019-01-02 14:31:41      阅读:181      评论:0      收藏:0      [点我收藏+]

$sql = "
(select id,‘1‘as type ,content,photo,issuetime as t from experience where userid = {$userid})
UNION ALL
(select id,‘2‘as type, name as content,id as photo,ts as t from importantday where userid = {$userid})
UNION ALL
(select id,‘3‘as type,title as content,id as photo,ts as t from inspiration where userid = {$userid})
UNION ALL
(select id,‘4‘as type,title as content,photo,issuetime as t from sendword where userid = {$userid})
ORDER BY t desc
";

 

 

字段数量与字段名 必须保持一致

ThinkPHP/---union

原文:https://www.cnblogs.com/Gupq/p/10208255.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!