Help with 'update' statement
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Help with 'update' statement

  1. #1
    Join Date
    Dec 1999
    Posts
    217

    Help with 'update' statement

    Hi Guys,

    Please take a look at this update statement and guide me as to what am I doing wrong:

    update orders set
    orders.state_key = geography.state_key
    where
    orders.geography_key = geography.geography_key;

    when I run this statemnt I get the following error:

    orders.geography_key = geography.geography_key
    *
    ERROR at line 4:
    ORA-00904: "GEOGRAPHY"."GEOGRAPHY_KEY": invalid identifier

    Appreciate you input,

    Chintz

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Assuming there is a orders.geography_key...

    Code:
    update orders o
       set o.state_key = (
          select g.state_key 
          from geography g 
          where g.geography_key = o.geography_key)
    where o.geography_key in (select geography_key from geography)
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

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