Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    60

    Unanswered: to insert multiple records in a table from already existig table

    HI,
    I want to insert multiple records in single command from emp whose dname=accounting into a table called emp2.

    Thanks in advance

    Abhi :

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If 'emp' and 'emp2' are the same, the simplest way would then be

    INSERT INTO emp2
    SELECT * FROM emp
    WHERE dname = 'ACCOUNTING';

    If those tables don't have the same description, you'll have to include column list into the INSERT statement.

  3. #3
    Join Date
    Sep 2004
    Posts
    60

    Thumbs up

    Thanks
    but the ename is in dept table
    & ina trial I found the solution as:

    insert into emp2
    select emp.* from emp , dept
    where emp.deptno =dept.deptno
    and dept.dname = 'ACCOUNTING'

    Although, Thanks for viewing

    Abhi

Posting Permissions

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