I have 2 tables - IdentificationChallenges and IdentificationResults.
The challenges table shows a list of challenges and the results table stores a users attempt at the challenge.
I need a query to return all challenges that the user hasn't attempted (where the user id doesn't exist in the results table). My attempt at this is as follows:
SELECT ic.* from IdentificationChallenges ic LEFT JOIN IdentificationResults ir ON ic.Id = ir.ChallengeId WHERE ir.UserId != 'cfc1d26c-c091-4b17-aaa3-31e8f5232cf9' ORDER BY NEWID() It does not retrieve any records. Any idea where I'm going wrong?
IdentificationChallenges
Id | ChallengeDateTime | ImageUrl | Description IdentificationResults
Id | ChallengeId | UserId | ChallengeResult | ResultDateTime
ir.UserId =becauseir.UserIdwill be null.