Results 1 to 3 of 3

Thread: SQL Query Help

  1. #1
    Join Date
    Mar 2004

    Unanswered: SQL Query Help


    how would i select something from one table and put it into another, ie select name from details table and insert it into friends table? can it be done in one statement, i'm lost?!!

    thanks alot

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    A lot depends on how you define "one statement", but you can certainly use:
    INSERT INTO friends (name) SELECT DISTINCT name FROM details
    to take one copy of each name from the details table and place them into the friends table.

    It is your call as to whether that is one compound statement, or two atomic statements. From an execution standpoint, they are a single statment executed by the SQL engine. From a syntax standpoint, they are two separate statements that are executed as one.


  3. #3
    Join Date
    Mar 2004
    well i dont mind one or two statements either way as long as it works

Posting Permissions

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