Or without a subquery,
SELECT s.questionid, s.userid FROM SurveyAnswers s LEFT JOIN Users u ON u.id = s.userid WHERE u.id IS NULL;
Brian wrote:
select s.userid from surveyanswers s where s.userid not in (select distinct u.id from users u)
On Tue, 19 Oct 2004 16:30:29 -0600, Jonathan Duncan <[EMAIL PROTECTED]> wrote:
I have a user who is using the following query to try and delete rows from one table based on the lack of a user id in another table:
SELECT s.questionid, s.userid, s.questionanswer FROM Users u, SurveyAnswers s WHERE u.id != s.userid
The corresponding user rows have already be deleted from the table Users. Thus, this of course seems to match on just about everything since there is no actualy record in the Users table to match on.
Is there some way to match on a lack of information?
Thanks, Jonathan Duncan
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]