DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: sql update without pl/sql

  1. #1
    Join Date
    Feb 2001
    Location
    Master Control
    Posts
    86

    sql update without pl/sql

    i can use a cursor do get my desired result, however can this be done with just an sql statement?

    update tbl1
    set f1 = (select f2 from tbl2 where... basically a bunch of f2s)
    where f2 = (select f3 from tbl2 where... basically a bunch of f3s)

    all the f3s are unique.

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492
    Try this:

    update tbl1
    set f1 = (select f2 from tbl2
    where tbl1.f2 = tbl2.f3)
    where f2 in (select f3 from tbl2
    where... basically a bunch of f3s)
    /

  3. #3
    Join Date
    Feb 2001
    Location
    Master Control
    Posts
    86
    ah...'in'...i completely forgot about that! thanks for the help!


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