MySQL Forums
Forum List  »  InnoDB

Re: Create a row, use id as value in another row?
Posted by: Don Ireland
Date: December 22, 2015 08:36PM

Sorry for got to add the code....

CREATE TABLE test (
id INT(6) AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30) NOT NULL,
parentID INT(6)
)

INSERT INTO `test` (`name`, `parentID`) VALUES
('child',
INSERT INTO `test` (`name`) VALUES ### subquery to insert a row. The id field from this will be used as the parentID value of the main query.('top');
);

Don

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Create a row, use id as value in another row?
832
December 22, 2015 08:36PM


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.