码迷,mamicode.com
首页 > Web开发 > 详细

ThinkPHP/---union

时间:2019-01-02 15:09:45      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:sel   hot   word   iss   select   day   think   where   必须   

$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

标签:sel   hot   word   iss   select   day   think   where   必须   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!