select a.column from table a where a.column!='value' group by a.column
union all select b.column from table b where b.column='value' group by b.column
select a.column from table a where a.column!='value' group by a.column
union all select b.column from table b where b.column='value' group by b.column