|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Testing a query
Code:
SELECT tags.title,
artist.name,
statistics.rating,
statistics.playcounter,
statistics.percentage -- score
FROM statistics -- tags -- artist
INNER JOIN tags
ON tags.url = statistics.url
INNER JOIN artist
ON artist.id = tags.artist
WHERE statistics.percentage >= 70 OR
statistics.playcounter = 0
AND
(statistics.rating >= 6 OR
statistics.rating = 0);
this is my query as it stands.... but results vary based on parenthesis. I need to test whether it returns anything for rating < 6 I'd also like to know what the difference in records is between this and Code:
WHERE (statistics.percentage >= 70 OR
statistics.playcounter = 0)
AND
(statistics.rating >= 6 OR
statistics.rating = 0);
__________________
A blog listing abandoned open source projects. http://maintainance-required.blogspot.com/ |
|
#2
|
||||
|
||||
|
this --
Code:
WHERE statistics.percentage >= 70 OR
statistics.playcounter = 0
AND
(statistics.rating >= 6 OR
statistics.rating = 0);
Code:
WHERE statistics.percentage >= 70 OR (
statistics.playcounter = 0
AND
(statistics.rating >= 6 OR
statistics.rating = 0) );
it's similar to the way multiplication takes precedence over addition 3 + 4 * ( 5 + 6 ) = 47 what i think you want is Code:
WHERE (statistics.percentage >= 70 OR
statistics.playcounter = 0)
AND
(statistics.rating >= 6 OR
statistics.rating = 0);
( 3 + 4 ) * ( 5 + 6 ) = 77 |
|
#3
|
|||
|
|||
|
thanks for that. I didn't think to pull up information on 'order of operations'.
stilled like to be able to figure out how to query it. I just need to make sure nothing with a rating of 2 or 4 matches. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Testing a query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|