List:General Discussion« Previous MessageNext Message »
From:Pete Harlan Date:July 9 2004 6:17pm
Subject:Re: Between Operator
View as plain text  
On Fri, Jul 09, 2004 at 09:39:02AM -0500, Craig Hoffman wrote:
> Style:  Traditional
> Area:  Yosemite
> Rating: From: 5.5 To: 5.10c
...
> "SELECT * FROM routes, users WHERE area='$area' AND style='$style'  
> BETWEEN rating='[$rating1]' AND rating='[$rating2]' GROUP BY route 
> ORDER BY rating ASC ";
> 
>  For some reason which I am not seeing, this query is not doing what it 
> should be doing.  Does anyone have any suggestions?

For starters your between syntax isn't correct (but is parsable in
ways you didn't want).  You probably want:

	select	*
	from	routes, users
	where	area = '$area'		and
			style = '$style'	and
			rating between '$rating1' and '$rating2'
	group by route
	order by rating

As others have pointed out, your ratings aren't something MySQL will
know how to order.  That's a separate problem (and more difficult to
solve), but the between syntax is also one.

--Pete
Thread
Between OperatorCraig Hoffman9 Jul
  • Re: Between OperatorKeith Ivey9 Jul
    • Re: Between Operator(Michael Johnson)9 Jul
  • Re: Between Operator(Pete Harlan)9 Jul
    • Re: Between OperatorCraig Hoffman10 Jul
      • Re: Between Operatormos10 Jul
  • Re: Between OperatorMartin Gainty10 Jul