www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > SQL

    SQL For all Structured Query Language, and general database questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 03-09-2006, 08:24 AM
    lomokev lomokev is offline
    Registered User
     
    Join Date: Aug 2004
    Location: Brighton,UK
    Posts: 96
    MySql copying a whole row into the same table

    is there a quick and easy way to copy a whole row in a table and copy it the same table? obviously i want the ID to change to the next auto_increment value.
    Reply With Quote
      #2  
    Old 03-09-2006, 11:18 AM
    chazzy's Avatar
    chazzy chazzy is offline
    Working class hero
     
    Join Date: Aug 2005
    Location: The Garden State
    Posts: 5,635
    INSERT INTO the_table(column_list) SELECT column_list FROM the_table;

    obviously you're going to want to skip the ID when doing the column list.
    __________________
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:31 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.