Need help with error on JOIN statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrsbagdirt
    New Member
    • Sep 2008
    • 2

    Need help with error on JOIN statement

    I get the following error when running the query below:

    Tables or functions 'AST_CMDB_Assoc iations' and 'AST_CMDB_Assoc iations' have the same exposed names. Use correlation names to distinguish them.

    I have looked up information regarding correlation names but it just doesn't make sense to me. It's obvious I don't really know what I am doing. Can anyone help? Thanks in advance.

    UPDATE AST_ComputerSys tem
    SET AST_ComputerSys tem.Supported = '1'
    from AST_CMDB_Associ ations, AST_ComputerSys tem, AST_AssetWarran ty
    INNER JOIN AST_ComputerSys tem ON AST_ComputerSys tem.Reconciliat ion_Identity = AST_CMDB_Assoca tions.Request_I D01
    INNER JOIN AST_CMDB_Associ ations ON AST_AssetWarran ty.instanceId =
    AST_CMDB_Associ ations.Request_ ID02
    WHERE((AST_Asse tWarranty.Expir ation_Date >Currentdate) )
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Must admit not familiar with this one.
    But at a guess it is likely because you have JOINed to the same table.
    Nothing wrong with that but you need to alias them both,
    then refer to the alias in the table.fieldname prefix
    Code:
    from AST_CMDB_Associations aca, AST_ComputerSystem, AST_AssetWarranty
    INNER JOIN AST_ComputerSystem ON AST_ComputerSystem.Reconciliation_Identity = aca.Request_ID01
    INNER JOIN AST_CMDB_Associations acma ON AST_AssetWarranty.instanceId =
    Or something along those lines

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      Try this:

      Code:
      UPDATE AST_ComputerSystem 
      SET AST_ComputerSystem.Supported = '1' 
      from AST_AssetWarranty
      INNER JOIN AST_CMDB_Associations ON AST_AssetWarranty.instanceId = AST_CMDB_Associations.Request_ID02 
      INNER JOIN AST_ComputerSystem ON AST_ComputerSystem.Reconciliation_Identity = AST_CMDB_Assocations.Request_ID01
      WHERE(AST_AssetWarranty.Expiration_Date > Currentdate)
      Good Luck.

      Comment

      • mrsbagdirt
        New Member
        • Sep 2008
        • 2

        #4
        That did it! Thanks so much for the help.


        Originally posted by iburyak
        Try this:

        Code:
        UPDATE AST_ComputerSystem 
        SET AST_ComputerSystem.Supported = '1' 
        from AST_AssetWarranty
        INNER JOIN AST_CMDB_Associations ON AST_AssetWarranty.instanceId = AST_CMDB_Associations.Request_ID02 
        INNER JOIN AST_ComputerSystem ON AST_ComputerSystem.Reconciliation_Identity = AST_CMDB_Assocations.Request_ID01
        WHERE(AST_AssetWarranty.Expiration_Date > Currentdate)
        Good Luck.

        Comment

        Working...