Kusum Kusum - 5 months ago 17
SQL Question

Exclude null value during full outer join

How to join these two tables with excluding all null values?

And Instead of UserId in 2nd table I want the user name from first table information.

enter image description here

Answer

You can achieve desire result by using INNER JOIN

SELECT UserProfile.*
FROM UserProfile
INNER JOIN UserLoginHistory ON UserProfile.UserId = UserLoginHistory.UserId AND UserLoginHistory.LogoutTime IS NOT NULL