i have set of 2 tables , trying achieve select both , , display table selected + active=1 set values taken table2 (in first table there boolean = active, in table2 active no need column there) wrote still want data being selected table2 set active in result.
i totally stuck, appreciate help.
create table `table1` ( `id` int(11) not null auto_increment, `value` int(11) default null, `active` bool default null, ) create table `table2` ( `id` int(11) not null auto_increment, `value` int(11) default null, primary key (`id`) )
select *, 't1' tablename table1 union select *, true 'active', 't2' tablename table2
Comments
Post a Comment