SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    Location
    usa
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What's Wrong W/ This Quary In Access

    hI , this is a self join

    SELECT F.PARTNUM, F.DESCRIPTION,
    S.PARTNUM, S.DESCRIPTION
    FROM F.PART, S.PART
    WHERE F.PARTNUM=S.PARTNUM
    AND F.DESCRIPTION <> S.DESCRIPTION;


    and how the book says F.DESCRIPTION <> S.DESCRIPTION
    ,if it is self join , so it means everything is the same?????
    thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    partnum description
    1234567 widget
    2002001 gizmo
    4447263 gadget
    4004008 gizmo
    4447263 doohickey
    5532456 thingie

    run your query on that and see what pops out
    Last edited by r937; May 21, 2004 at 12:16.
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    TX
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error or no records??

    I don't alias the tables in the way that you do...
    Code:
    FROM F.PART, S.PART
    ...and when I tried, I got an error.

    If you're not getting any error what so ever, then you're simply not getting any records returned then?...if so that seems correct to me.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    good one, null, i totally missed the obvious syntax error

    assuming that's corrected,
    Code:
    from part as F, part as S
    then the next step is to realize that a self-join does not mean everything is equal, as i hope my example shows
    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
  •