In the query below, I want to obtain all options_totals table records(500 or so), 
except for those
users_options records where the userID=3. 
i.e. Not retrieve options the user has already selected.

Have tried many combinations of joins, but get either just the records which are in 
the users_options
table, less userID=3, or failing that no records at all.

SELECT DISTINCT options_totals.optionID AS optionID, options.optioncode, 
options_totals.nameID
, options_names.cname, users_options.listtype AS listtype, users_options.userstatus AS 
userstatus
, users_options.userID AS userID
FROM options_totals
LEFT JOIN options_names ON options_names.ID = options_totals.nameID
LEFT JOIN options ON options.ID = options_totals.optionID
LEFT JOIN users_options ON options_totals.optionID = users_options.optionID
WHERE userID <> 3
ORDER BY userID

Appreciate if someone can show me the right syntax.
Graham

Reply via email to