Hi,
i have 2 tables as following:
Employee_Info
ID Employee_Name Date_Started SickDays
1-1 Joe Mar 1 2
12-2 Randall Feb 2 5
12-5 Pam April 9 6
Employees_YearsOfWork
ID Years Date_Completed
1-1 2 Dec 12
12-2 7 Jun 15
12-5 15 Aug 11
In my results panel I have to show all the 6 entries above...
ID Employee_Name Date_Started SickDays Years Date_Complete
So i have the following query...
Select ID, Employee_Name, Date_Started, '' as Years, '' as Date_Completed
From Employee_Info
group by ID, Employee_Name, Date_Started
UNION
Select ID, '' as Employee_Name,'' as Date_Started, Years, Date_Completed
From Employees_YearsOfWork
group by ID, Years, Date_Completed
The results looks like the following:
ID Employee_Name Date_Started SickDays Years Date_Complete
1-1 Joe Mar 1 2
12-2 Randall Feb 2 5
12-5 Pam April 9 6
1-1 2 Dec 12
12-2 7 Jun 15
12-5 15 Aug 11
So I need to populate the rest of the empty feilds from each other... In the end I should end up will 6 rows like the follwoing:
ID Employee_Name Date_Started SickDays Years Date_Complete
1-1 Joe Mar 1 2 2 Dec 12
12-2 Randall Feb 2 5 7 Jun 15
12-5 Pam April 9 6 15 Aug 11
1-1 Joe Mar 1 2 2 Dec 12
12-2 Randall Feb 2 5 7 Jun 15
12-5 Pam April 9 6 15 Aug 11
Yes i need repititive data...
Thanks for your help...
i have 2 tables as following:
Employee_Info
ID Employee_Name Date_Started SickDays
1-1 Joe Mar 1 2
12-2 Randall Feb 2 5
12-5 Pam April 9 6
Employees_YearsOfWork
ID Years Date_Completed
1-1 2 Dec 12
12-2 7 Jun 15
12-5 15 Aug 11
In my results panel I have to show all the 6 entries above...
ID Employee_Name Date_Started SickDays Years Date_Complete
So i have the following query...
Select ID, Employee_Name, Date_Started, '' as Years, '' as Date_Completed
From Employee_Info
group by ID, Employee_Name, Date_Started
UNION
Select ID, '' as Employee_Name,'' as Date_Started, Years, Date_Completed
From Employees_YearsOfWork
group by ID, Years, Date_Completed
The results looks like the following:
ID Employee_Name Date_Started SickDays Years Date_Complete
1-1 Joe Mar 1 2
12-2 Randall Feb 2 5
12-5 Pam April 9 6
1-1 2 Dec 12
12-2 7 Jun 15
12-5 15 Aug 11
So I need to populate the rest of the empty feilds from each other... In the end I should end up will 6 rows like the follwoing:
ID Employee_Name Date_Started SickDays Years Date_Complete
1-1 Joe Mar 1 2 2 Dec 12
12-2 Randall Feb 2 5 7 Jun 15
12-5 Pam April 9 6 15 Aug 11
1-1 Joe Mar 1 2 2 Dec 12
12-2 Randall Feb 2 5 7 Jun 15
12-5 Pam April 9 6 15 Aug 11
Yes i need repititive data...
Thanks for your help...