SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member skippy295's Avatar
    Join Date
    Mar 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changed syntax in from clause

    Hi,

    I used to programme in SQL when the dinosaurs roamed the Earth! Today I was checking out some code where the word "select" appears in the middle of the from clause. Could someone please tell me what this means or at least point me to a Web site that can clarify the issue?

    Thank you,

    skippy295

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It's called a subquery. The results of the subquery act like a table you can select from in the outer query.

  3. #3
    SitePoint Member skippy295's Avatar
    Join Date
    Mar 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan... In the OLD days when I was programming a subselect had the same syntax as a full select but was inside parentheses. Clearly they have streamlined things somewhat. I looked up a few Web sites on subqueries and I don't think I explained things properly. The from clause looks like this:

    "...From products p, select manufacturers m using (manufacturers_id), product_description pd, select specials s on p.products_id = s.products_id, categories c, products_to_categories p2c..."
    Last edited by skippy295; Mar 9, 2009 at 05:57. Reason: I learned more about subqueries after Dan got back to me

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by skippy295 View Post
    ... a subselect had the same syntax as a full select but was inside parentheses.
    it's still like that today
    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
  •