SELECT 'Employees' AS [table_name], name, address FROM Employees WHERE [my_condition] UNION ALL SELECT 'Employees_history' AS [table_name], name, address FROM Employees_history WHERE [my_condition]
I use UNION ALL , not UNION , as there will be no duplicates in the two branches. Therefore, it can avoid the unnecessary work of removing duplicates in the entire result set.
If there may be duplicates in the branch, add DISTINCT to the individual SELECT (s)
source share