$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