List:General Discussion« Previous MessageNext Message »
From:Keith Ivey Date:July 9 2004 3:38pm
Subject:Re: Between Operator
View as plain text  
Craig Hoffman wrote:

> This should pull up all the rock climbs that are in Yosemite, that are 
> traditional style and are between the rating 5.5 to 5.10c.  Here is my 
> query:
>
> "SELECT * FROM routes, users WHERE area='$area' AND style='$style'  
> BETWEEN rating='[$rating1]' AND rating='[$rating2]' GROUP BY route 
> ORDER BY rating ASC ";


Not sure what those square brackets are doing there, but your main 
problem is that MySQL has no way of knowing what order you think those 
rating strings should be in.  The string '5.5' is greater than '5.10c', 
and the number 5.5 is greater than 5.10.  I think you're going to need 
to change the way you represent the ratings -- maybe something like 
'5.05' and '5.10c' would work (depending on what other possibilities 
are, and how the letters are supposed to affect sorting). Then 
manipulate the strings to produce what you're used to when it comes time 
to display them (that, or have two columns: one for display and one for 
sorting).

-- 
Keith Ivey <keith@stripped>
Washington, DC

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