多表查询结果合并再操作
作者:
比博 | 来源:发表于
2018-11-27 10:01 被阅读0次$sql = "SELECT * FROM
(SELECT {$field}, {$comment_type} AS `type`
FROM `tab_comment`
WHERE `type`=1
AND `status`=1
AND `status_show`=1
AND `account`='{$account}'
UNION ALL
SELECT {$field}, {$collect_type} AS `type`
FROM `tab_collect_game`
WHERE `status`=1
AND `account`='{$account}'
UNION ALL
SELECT {$field}, {$down_type} AS `type`
FROM `tab_down_record`
WHERE `user_account`='{$account}'
) AS `t`
ORDER BY `create_time` DESC
LIMIT {$m},{$n}";
$data = $this->query($sql);
本文标题:多表查询结果合并再操作
本文链接:https://www.haomeiwen.com/subject/gwwwqqtx.html
网友评论