一样的联表查询,不一样的条件筛选,最后把数据整合到一起 UNION
select pro_parent as product_id from tb1
where pro_type = 'variation' group by pro_parent
UNION
select product_id as id from tb1 where pro_type = 'simple'
end 记录下先
- 补充下 mysql union
- select * from A union all select * from B //A B数据结构一定要一样
union 之后再做处理的话需要
(SELECT uid,umobile,realname FROM users WHERE vip IN (8, 9))
UNION
(SELECT uid,umobile,realname FROM users WHERE vip NOT IN (8, 9) AND amount > 0 )
ORDER BY uid desc limit 10
网友评论