List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:January 27 2000 4:22pm
Subject:Re: [Use of multiple = in SELECT statements]
View as plain text  
In the last episode (Jan 27), phill@stripped said:
> >Description:
> 	The use of three = clauses in a SELECT seems to return bogus results.
> >How-To-Repeat:
> 	mysql> SELECT profiles.percent, adverts.image,
> 	adverts.advert_id, profile.profile_id FROM profiles, profile,
> 	adverts WHERE (profile.profile_id = profiles.profile_id =
> 	profiles.profile_id = 1);

You need to replace one of your '='s with an AND:

SELECT profiles.percent, adverts.image, adverts.advert_id,
 profile.profile_id FROM profiles, profile, adverts WHERE
 (profile.profile_id = profiles.profile_id AND profiles.profile_id = 1);

I don't know any language that parses "a = b = c" as a triple-equality
compare.

-- 
	Dan Nelson
	dnelson@stripped
Thread
[Use of multiple = in SELECT statements]phill27 Jan
  • Re: [Use of multiple = in SELECT statements]sasha27 Jan
  • Re: [Use of multiple = in SELECT statements]Dan Nelson27 Jan