> Hi, > > I am the beginner of pgpsql > > > I need to select from two tables say T1,T2 by UNION > > when the value is from T1 the output should by a 1 and > when the value from T2 the out put should be 2 > > when T1 Hits values should be 1 and when T2 hits the value should be 2
select 'table 1' as table, * from t1 union all select 'table 2', * from t2;