Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Query Question

  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    317
    Thanks
    24
    Thanked 3 Times in 3 Posts

    Query Question

    Why does this statement work on my server

    Code:
    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...

    Code:
    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.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    what error message do you get on the one that does not run?

  • #3
    Regular Coder
    Join Date
    Apr 2007
    Posts
    317
    Thanks
    24
    Thanked 3 Times in 3 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Apr 2007
    Posts
    317
    Thanks
    24
    Thanked 3 Times in 3 Posts
    I'm also having a problem with this query.

    Code:
    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
    Last edited by macleodjb; 01-17-2012 at 07:59 PM. Reason: typo


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •