Results 1 to 6 of 6

Thread: SQL Problem

Threaded View

  1. #1

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    SQL Problem

    I have a table (tblGroupCases) where I am attempting to update a particular field, the problem is that in order to do this I have to join three tables. Two of these tables (Officers and Assoc_Inc_Off) are located in a different MS SQL db. I was thinking about creating a view joining the first two tables then using vb code to join the View and the table that I want to update. My question is can I join three tables in an Update query?
    The following is my failed attempt, tblGroupCases is the table I want to update with the data contained in the Officers table but I need to connect these two (2) table via the Assoc_Inc_Officer Table:


    VB Code:
    1. strSQL = "UPDATE GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases "
    2.             strSQL = strSQL & "SET GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases.Subject_Officer = "
    3.             strSQL = strSQL & "IADATA.DBO.OFFICERS.LNAM "
    4.             strSQL = strSQL & "FROM GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases, "
    5.             strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF, IADATA.DBO.OFFICERS "
    6.             strSQL = strSQL & "WHERE GROUP_MANAGEMENT.GROUP_MGMT.tblGroupCases.INCNUM =  IADATA.DBO.ASSOC_INC_OFF.INCNUM "
    7.             strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF.INCNUM = IADATA.DBO.Officers.INCNUM;"

    If I remove the last line:

    VB Code:
    1. strSQL = strSQL & "IADATA.DBO.ASSOC_INC_OFF.INCNUM = IADATA.DBO.Officers.INCNUM;"

    The code runs but it doesn't update the field.
    Thank you,
    Last edited by Mark Gambo; Dec 1st, 2003 at 05:43 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


Posting Permissions

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



Click Here to Expand Forum to Full Width