Lets say i have one table as below :
Create table tblEvents
(
Eventid int primary key,
EventName nvarchar(20),
UserId nvarchar(5)
)
and second table as :
Create table tblUsers
(
Id int primary key,
UserId nvarchar(5),
Username nvarchar(20),
)
How can i get a new table(or result) which has combined results from both.I am only concerned about tblEvents which should just show the UserName from tblUsers where Userid(of tblEvents) is equal to UserId(of tblUsers). So the final output should be in the below format :
EventId | EventName | UserId | UserName
--------|-----------|--------|---------
| | |
where UserName comes from tblUsers. I cannot change the primary keys on any of the table.
Edit : UserId is not INT and cannot be used as primary-foreign keys