SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql subquery ANY

    hi all,

    what does the ANY mean in this query, i have had a look online but from what i understand is it a work around if a subquery returns more than one record. not to sure

    select u from t1 where u = ANY(select x from t2)

    thanks
    D

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    you're right, it is syntax used to handle multiple rows from the subquery

    an equivalent is
    Code:
    SELECT u FROM t1 WHERE u IN (SELECT x FROM t2)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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