UNION 操作符用于合并两个或多个 SELECT 语句的结果集。
请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。
默认地,UNION 操作符选取不同的值。如果允许重复的值,请使用 UNION ALL
另外,UNION 结果集中的列名总是等于 UNION 中第一个 SELECT 语句中的列名。
select c.cont_id,cd.title, cd.title_img from content as c LEFT JOIN channel as ch on c.channel_id = ch.channel_id LEFT JOIN cont_detail as cd on c.cont_id = cd.cont_id
LEFT JOIN cont_text as ct on c.cont_id = ct.cont_id , cont_custom as cc where c.status = 1 and ch.channel_code = 'zhty_news' and c.cont_id = cc.cont_id and cc.field_name like '%recommend%'
and c.company_code ='zhty' and cc.field_value like concat('%','1','%')
union
select id, `name`, titleImg from venue WHERE ( recommend = 1 ) ORDER BY cont_id desc limit 0,5