SQL Query to return distinct UserID from combination of 3 tables
Posted on 2007-12-04
I am building the following query that uses 3 tables.
SELECT XYZQuiz.Name AS 'Course', XYZQuiz.Points AS 'Course Points', XYZQuizUserLog.Grade, XYZQuizUserLog.Points, XYZUser.FirstName, XYZUser.LastName, XYZUser.Email, XYZQuizUserLog.DateEntered, XYZUser.UserId
FROM XYZQuiz INNER JOIN
XYZQuizUserLog ON XYZQuiz.QuizID = XYZQuizUserLog.QuizID INNER JOIN
XYZUser ON XYZQuizUserLog.UserID = XYZUser.UserId
I would like for it NOT to return duplicate UserID values (distinct). I'm sure I have to use DISTINCT somewhere in there, but need some expert guidance on where.