I have an Employee table with these columns :
- EmployeeId
- Fullname
- Phone
- Department
- Team
- Function
- Manager
and EmployeeHistory containing the history with different columns, but there are some in common :
- EmployeeId
- Fullname
- Geolocation
- Department
- Team
- Function
- Manager
How can I union them?

Amira BedhiafiRank #601 · 4K reputationPosted Feb 27, 2024, 2:47 PM EST
You can them by dummy values.:
SELECT EmployeeId , Fullname , 'Undefined' AS Email, Phone , 'Undefined' AS Geolocation Department , Team , [Function] , Manager FROM Employee UNION ALL EmployeeId , Fullname , Email , '0000000000' AS Phone, Geolocation, Department , Team , [Function] , Manager FROM EmployeeHistory