List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 29 2001 4:07pm
Subject:Re: im puzzled
View as plain text  
I suspect he wants:

SELECT users.uid
FROM users LEFT JOIN picks
ON users.uid = picks.user_id
WHERE picks.user_id IS NULL

Paul DuBois wrote:

> At 10:36 AM -0400 8/29/01, Jeremy Morano wrote:
> 
>> Hi ,
>> 
>> this is my query
>> 
>> SELECT users.uid FROM users, picks WHERE users.uid = picks.user_id;
>> 
>> this works correctly. The results are what they are supposed to be:
>> However, when I change the = sign to a <> or !=, The results are 
>> completely
>> incorrect.
>> 
>> ----------------------------------
>> 
>> picks.user_id contains: 5, 1, 7, 8, 9, 12, 13, 15
>> 
>> users.uid contains: 1, 8, 9, 5, 7, 10, 11, 12, 13, 14, 15
>> 
>> 
>> the result for SELECT users.uid FROM users, picks WHERE users.uid =
>> picks.user_id; is:
>> 
>> 5, 1, 7, 8, 9, 12, 13, 15
>> 
>> and the result for SELECT users.uid FROM users, picks WHERE users.uid <>
>> picks.user_id; is:
>> 
>> 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 7, 8, 9, 10, 11,12, 13, 14, 15, 
>> 1, 5,
>> 8, 9, 10 ,11...etc
>> 
>> it goes on for 80 rows with no particular pattern......H.E.L.P.!.
> 
> 
> 
> Why do you think this is incorrect?  Change the query to begin like this:
> 
> SELECT users.uid, picks.user_id FROM ...
> 
> and then you'll see that there is a pattern, and that the query is 
> producing
> exactly what it's supposed to.
> 
> I'm guessing that you're really trying to ask a different question
> than the one the query is answering.  What exactly are you expecting
> as output?


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
im puzzledJeremy Morano29 Aug
  • Re: im puzzledGerald Clark29 Aug
  • Re: im puzzledPaul DuBois29 Aug
  • Re: im puzzledGerald Clark29 Aug