field - MySQL : How to know which table that record belongs to in UNION result -
lets want records 2 table using union. how add field each record tell me table belongs to? :
id | title | link | table ----------------------------------------------------- 1 | title 1 | somelink.html | articles1 2 | title 2 | link2 .html | articles2 3 | title 3 | link3 .html | articles1
thanks in advance?
select some_column, 'union_1' from_where table1 union select some_column, 'union_2' from_where table2
Comments
Post a Comment