[PHP-DB] Re: Query help

2004-07-09 Thread Peter Westergaard
Oh, and I assume you left out the part of the query where you bound tables
routes and users?
-P

"Craig Hoffman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "SELECT * FROM routes, users WHERE area='$area' AND style='$style'
> BETWEEN rating='[$rating1]' AND rating='[$rating2]' GROUP BY route
> ORDER BY rating ASC ";

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Query help

2004-07-09 Thread Peter Westergaard
I think you want:

"SELECT * FROM routes, users WHERE area='$area' AND style='$style'
AND rating BETWEEN '[$rating1]' AND '[$rating2]' GROUP BY route
 ORDER BY rating ASC ";

>From http://dev.mysql.com/doc/mysql/en/Comparison_Operators.html
"expr BETWEEN min AND max
If expr is greater than or equal to min and expr is less than or equal to
max, BETWEEN returns 1, otherwise it returns 0. This is equivalent to the
expression (min <= expr AND expr <= max) if all the arguments are of the
same type. Otherwise type conversion takes place according to the rules
described at the beginning of this section, but applied to all the three
arguments. Note: Before MySQL 4.0.5, arguments were converted to the type of
expr instead."

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Query Help!

2004-04-08 Thread JeRRy
Date: 8 Apr 2004 09:12:46 - 
To: [EMAIL PROTECTED] 
From: "David Robley" <[EMAIL PROTECTED]> 
Subject: Re: Query Help! 

Have you tried 
SELECT `username` , `score` FROM round" .
($round_number -1) . " WHERE 1
ORDER BY `score` DESC LIMIT 0, 30



Ahh just tried it and relised what is going on here. 
I was trying round" . $round_number-1 . " ...  (and
not in brackets)

I was close, but no cigar.  Thanks for the assistance.
:)

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Query Help!

2004-04-08 Thread JeRRy
Date: 8 Apr 2004 09:12:46 - 
To: [EMAIL PROTECTED] 
From: "David Robley" <[EMAIL PROTECTED]> 
Subject: Re: Query Help! 


[EMAIL PROTECTED] (Jerry) wrote in 
news:[EMAIL PROTECTED]:

> Hi Everyone, Happy Easter to you all.
> 
> I have this query, reasoning for posting on this
> Mailing List is under it. :)
> 
> SELECT `username` , `score` FROM round" .
> $round_number . " WHERE 1
> ORDER BY `score` DESC LIMIT 0, 30
> 
> Is there a way to make it output the $round_number
-1
> (minus one number)?
> 
> I need this to be a temp. meassure as I only need
the
> number previous to the current $round_number for a
few
> days.  Is there a way in the query I can subtrack
the
> value by 1 and change it later when I want to show
the
> current round?
> 
> If it's too much hassles I can add
$prev_round_number
> and change the values each week but thought there
> might be another way.

Have you tried 
SELECT `username` , `score` FROM round" .
($round_number -1) . " WHERE 1
ORDER BY `score` DESC LIMIT 0, 30


Nope, but I will, I'll let you know. :)

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Query Help!

2004-04-08 Thread David Robley
[EMAIL PROTECTED] (Jerry) wrote in 
news:[EMAIL PROTECTED]:

> Hi Everyone, Happy Easter to you all.
> 
> I have this query, reasoning for posting on this
> Mailing List is under it. :)
> 
> SELECT `username` , `score` FROM round" .
> $round_number . " WHERE 1
> ORDER BY `score` DESC LIMIT 0, 30
> 
> Is there a way to make it output the $round_number -1
> (minus one number)?
> 
> I need this to be a temp. meassure as I only need the
> number previous to the current $round_number for a few
> days.  Is there a way in the query I can subtrack the
> value by 1 and change it later when I want to show the
> current round?
> 
> If it's too much hassles I can add $prev_round_number
> and change the values each week but thought there
> might be another way.

Have you tried 
SELECT `username` , `score` FROM round" .
($round_number -1) . " WHERE 1
ORDER BY `score` DESC LIMIT 0, 30

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php