There is a table Log with a primary key LogId . There is also a UserLog table with a userlogIdLog field.

Relationship tables such:

 Log.LogId = UserLog.userlogIdLog 

It is necessary to display all records from the Log table except for those that are in the UserLog . In this case, the records in the userlog may not be.

I did the following:

 SELECT * FROM log RIGHT OUTER JOIN userlog ul ON ul.userlogIdLog = log.LogId WHERE log.LogId IS NULL 

1 answer 1

Reply from comments

Since you need to extract records from the log table, it is wiser to use the LEFT JOIN intersection, which guarantees that all records from the log will be extracted, which you can filter in the WHERE condition

 SELECT * FROM log LEFT JOIN userlog ul ON ul.userlogIdLog = log.LogId WHERE ul.userlogIdLog IS NULL 
  • one
    instead of WHERE you can AND - Serge Esmanovich