i have a TB_Users table having userid(primary key) and UName (i.e.,username). I have another table TB_Devices having ProjectManager, & ReceivedBy fields referring to UserID of Users table. Now i have created a view via SQL Server Management Studio, & here is the code automatically generated:
SELECT dbo.TB_Devices.ProjectName, dbo.TB_Devices.ProjectManager, dbo.TB_Devices.ReceivedBy, dbo.TB_Users.UName
FROM dbo.TB_Users INNER JOIN
dbo.TB_Devices ON dbo.TB_Users.UserID = dbo.TB_Devices.ProjectManager AND dbo.TB_Users.UserID = dbo.TB_Devices.ReceivedBy
the problem is this code will give me only those rows where both ProjectManager and ReceivedBy are the same.
I found some results on google telling me to use aliases to distinguish between ProjectManager & the ReceivedBy fields in the Users table, but I couldn't do it
Can anyone tell me how to get through this?