Complex Select Help Needed

Discussion in 'MySQL' started by zyklon, Feb 4, 2010.

  1. #1
    Alright so i'm trying to do a complex select in which i:

    1. Get All Ip's where they have the provided section #
    2. and then get the list of sections that those ip's specify ordered by the count of the number of those sections.

    Here is what I've written so far, it doesnt seem to work:

    SELECT Episode_ID, count(Episode_ID) FROM tracker WHERE Episode_ID IN (SELECT Episode_ID FROM tracker WHERE IP IN (SELECT IP FROM tracker WHERE Episode_ID = 33)) ORDER BY count(Episode_ID);
    
    Code (markup):
    edit: the 33 in the code is just a same ID, it could be any number
     
    Last edited: Feb 4, 2010
    zyklon, Feb 4, 2010 IP
  2. clinton

    clinton Well-Known Member

    Messages:
    2,166
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Just wanted to make sure...is this MySQL?
     
    clinton, Feb 4, 2010 IP
  3. zyklon

    zyklon Active Member

    Messages:
    274
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #3
    yes that is correct.
     
    zyklon, Feb 4, 2010 IP