...

View Full Version : Query Question



macleodjb
01-17-2012, 06:39 PM
Why does this statement work on my server



SELECT *
FROM game_results
WHERE drawing_id = any (
SELECT * FROM (SELECT drawing_id FROM game_drawings WHERE game_id = 74 ORDER BY drawing_date DESC LIMIT 10)
alias)
LIMIT 50;


but this one does not...



SELECT *
FROM game_results
WHERE drawing_id = any (SELECT drawing_id FROM game_drawings WHERE game_id = 74 ORDER BY drawing_date DESC LIMIT 10)
LIMIT 50;


I dont get it.

guelphdad
01-17-2012, 07:19 PM
what error message do you get on the one that does not run?

macleodjb
01-17-2012, 07:53 PM
I get the message where it says that in/any/all are not supported on this version of mysql, but yet the other query works just fine.

macleodjb
01-17-2012, 07:59 PM
I'm also having a problem with this query.



SELECT *
FROM game_results
WHERE drawing_id IN (
SELECT * FROM (SELECT drawing_id FROM game_drawings WHERE game_id = 74 ORDER BY drawing_date DESC LIMIT 10)
alias)
AND result_type = 'WhiteBall'
ORDER BY drawing_id DESC, result_position
LIMIT 50;


The problem is that the drawing_id's that are being retrieved from this subquery (SELECT drawing_id FROM game_drawings WHERE game_id = 74 ORDER BY drawing_date DESC LIMIT 10)

are not the results being returned. There are alternate drawing_ids being returned. My goal for this query was to return all the results ONLY for those drawing_id's



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum