Add "field" of table name to SQL results from UNION?
select name, phone, 'users' as table_name from usersunionselect name, phone, 'vendors' as table_name from vendors;
Better solution will be to use union all
, so server will not be checking for distinct values
select name, phone, 'users' as table_name from usersunion allselect name, phone, 'vendors' as table_name from vendors;