2

I have two tables in my SQL Server database:

Person

ID Lastname  Age
1  Jones     46
2  Smith     37

Employee

ID(FK) Firstname Surname
1      Bob       [empty string]
2      Janet     [empty string]

I want to combine Employee as follows. (I will then be removing the Lastname from person, but let's not worry about that for now.)

Employee 
ID (FK)   Firstname  Surname
1         Bob        Jones
2         Janet      Smith

How can I do that?

William Jockusch
  • 26,513
  • 49
  • 182
  • 323

2 Answers2

2

I Think you should try this query, by this way you will have your desired result based on both tables.

Select E.ID, E.FirstName P.Lastname As Surname From Person P
Inner join Employee E ON p.ID = E.ID
Chiragkumar Thakar
  • 3,616
  • 5
  • 37
  • 49
2
Select E.ID, E.Firstname, P.Lastname as Surname from Employee E 
inner join Person P on P.ID=E.ID
Haytem BrB
  • 1,528
  • 3
  • 16
  • 23