MySQL Forums
Forum List  »  Newbie

Re: Table Insert Question
Posted by: Rick James
Date: February 18, 2009 01:07AM

Eh? Sounds rather complicated. How about simply:

DROP TABLE IF EXISTS harbor_layout;
CREATE TABLE harbor_layout (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    dock CHAR(60)
);

INSERT INTO harbor_layout
         (dock)
    SELECT Concat(float_num,' : ',permanent_assignee,
                            ' *',temporary_assignee )
         FROM harbor
         Order by harbor.id asc;
By not specifying "id" in the INSERT, and because it is AUTO_INCREMENT, "id" will be automatically assigned, beginning with 1.

Options: ReplyQuote


Subject
Written By
Posted
February 13, 2009 09:51PM
Re: Table Insert Question
February 18, 2009 01:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.