mysql insert in to statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganeshp
    New Member
    • May 2007
    • 38

    mysql insert in to statement

    Hi All,

    INSERT INTO tab_name (ID,NAME) VALUES (0,"zero" );
    INSERT INTO tab_name (ID,NAME) VALUES (1,"one" );

    Can the above two statements be combined in to just one INSERT INTO statement

    Please help
  • Stang02GT
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Originally posted by ganeshp
    Hi All,

    INSERT INTO tab_name (ID,NAME) VALUES (0,"zero" );
    INSERT INTO tab_name (ID,NAME) VALUES (1,"one" );

    Can the above two statements be combined in to just one INSERT INTO statement

    Please help

    I believe you will need to keep them separate but you can have one insert for the NAMES and one insert for the ID's

    INSERT INTO Table Name (ID) VALUES(0,1,2)
    INSERT INTO Table Name (Name) VALUES ("zero", "one", "two")

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Code:
      values(1, 2),  (4, 5), (6,7);
      Check the refmanual.

      Comment

      • ganeshp
        New Member
        • May 2007
        • 38

        #4
        thank you very much

        Regards,
        Ganesh

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Welcome, always refuse to write a single line of sql without the refmanual.

          Comment

          Working...