#1
  1. No Profile Picture
    almost there....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    A Red Glitter Coffin
    Posts
    140
    Rep Power
    0

    Exclamation an IS IN clause?


    Is there a keyword where i can do something like this:

    SELECT m.name FROM members m, membernumbers q
    WHERE m.number IS IN q.number

    ???
    basically give all the names of members whose number is in the column in the second table?

    If not i need some serious help please check out my other post entitled table of REFs from Nov 19th!
  2. #2
  3. No Profile Picture
    almost there....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    A Red Glitter Coffin
    Posts
    140
    Rep Power
    0
    oh found it!

    for anyone looking for it its just

    IN:

    eg SELECT m.name FROM members m, numbers n
    WEHRE m.number IN n.num

    or something
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,240
    Rep Power
    4279
    SELECT m.name
    FROM members m
    , numbers n
    WHERE m.number = n.num

    why IN?
  6. #4
  7. No Profile Picture
    almost there....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    A Red Glitter Coffin
    Posts
    140
    Rep Power
    0
    Oh, the example was simplified.

    I had a table of REFs and i wanted to see if a certain REF was in it, i couldn't use equals because it gave me an error saying single row subquery only or something like that...

    It wouldn't work, but it does for IN

    here's the statement...

    SELECT s.stuid, s.name, s.age
    FROM studentmembers s
    WHERE REF(s) IN
    (SELECT * FROM TABLE
    (SELECT playerlist
    FROM hometeams
    WHERE id = 1));

    It wouldn't work with equals, but it does with IN!

IMN logo majestic logo threadwatch logo seochat tools logo