sql loop?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: sql loop?

  1. #1
    Join Date
    Feb 2000
    newbie sql question:

    how would i insert records into a table or multiple tables based on the results of another query?


    select a, b, c, from mytable

    loop results

    insert into mytable1 (e,f,g,h,i)
    values (loop.a, loop.b, loop.c, other_value1, other_value2)

    end loop

    sorry if its basic..

  2. #2
    Join Date
    Aug 2002

    Not Sure if this is what you want:

    insert into mytable1 (e,f,g,h,i)
    select a,b,c,d,e
    from table2,table3...
    where table2.XX=table3.XXX
    and ...

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