Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    1

    Unanswered: Update data from another Table

    I am trying to update a field in one table - based on data stored in another table and was wondering what the SQL statement may look like ?
    I used
    update inventoryADG
    set inventotyADG.ListPrice = (select inventory.user3
    from inventory
    where inventory.user3<>0)

    but it doesn't work
    Anyway, any help would be appreciated.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    What is the error it is reporting back? IS it that the subquery returned more then one result??

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149

    Re: Update data from another Table

    I would imagine you might want to join the table in the main query and the sub query. If that is what you want try this

    update inventoryADG
    set inventotyADG.ListPrice = inventory.user3
    from inventory, inventoryADG
    where inventory.user3<>0
    and ...............

    Originally posted by hsuzuki
    I am trying to update a field in one table - based on data stored in another table and was wondering what the SQL statement may look like ?
    I used
    update inventoryADG
    set inventotyADG.ListPrice = (select inventory.user3
    from inventory
    where inventory.user3<>0)

    but it doesn't work
    Anyway, any help would be appreciated.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    The problem is that the query

    select inventory.user3
    from inventory
    where inventory.user3<>0

    is returning more than 1 record. You need to post the schema for both tables and be more specific what you are trying to update.

Posting Permissions

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