连接查询
JOIN 按照功能大致分为如下三类:
INNER JOIN(内连接,或等值连接):获取两个表中字段匹配关系的记录。
LEFT JOIN(左连接):获取左表所有记录,即使右表没有对应匹配的记录。
RIGHT JOIN(右连接):与 LEFT JOIN相反,用于获取右表所有记录,即使左表没有对应匹配的记录。
Union查询
select count(member) from ( ( select created_by as member from hrs.disease where owner_id = '8e93c47e16b0e') union ( select online_by as member from hrs.disease where owner_id = '8e93c47e16b0e' ) ) member;复制代码