SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    vi
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Getting the ID that are not equal

    I am trying to run this wquery that compares two sets of data in my SQL DB table UserData.

    But I am only trying to locate the IDs that are different. It is only three Ids that are different in each tp_ListID.

    but i cannot get it to return any values, PLEASE HELP>>>>>>
    Code:
    SELECT     dbo.UserData.tp_ID, dbo.UserData.tp_ListId, UserData_1.tp_ID AS Expr1, UserData_1.tp_ListId AS Expr2
    FROM         dbo.UserData INNER JOIN
                          dbo.UserData AS UserData_1 ON dbo.UserData.tp_ID <> UserData_1.tp_ID
    Where dbo.UserData.tp_ListID='{9E4E6B81-42F1-4903-8D0A-4338057A0B6B}' and UserData_1.tp_ListID='{5AB67B85-4C9E-486D-874A-DBD456042F17}'

  2. #2
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code SQL:
    SELECT dbo.UserData.tp_ID, 
           dbo.UserData.tp_ListId, 
           UserData_1.tp_ID AS Expr1, 
           UserData_1.tp_ListId AS Expr2
      FROM dbo.UserData
    FULL OUTER
      JOIN dbo.UserData AS UserData_1
        ON dbo.UserData.tp_ID = UserData_1.tp_ID
     WHERE dbo.UserData.tp_ListID='{9E4E6B81-42F1-4903-8D0A-4338057A0B6B}' 
       AND UserData_1.tp_ListID='{5AB67B85-4C9E-486D-874A-DBD456042F17}'
       AND (UserData_1.tp_ID IS NULL
        OR UserData.tp_ID IS NULL)


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
  •