开发者

Merge 2 SQL insert queries

开发者 https://www.devze.com 2023-02-11 04:56 出处:网络
Ok not really sure how to explain this but here goes ... I have a database lets call it foo with 1 table that has 3 rows row1,2,3 (row1 being id int auto) and I have 2 insert sql queries I need to me

Ok not really sure how to explain this but here goes ...

I have a database lets call it foo with 1 table that has 3 rows row1,2,3 (row1 being id int auto) and I have 2 insert sql queries I need to merge so they align:

INSERT INT开发者_开发问答O `table` (`row2`) VALUES ('value');

INSERT INTO `table` (`row3`) VALUES ('value');

1, Is it possible? 2, If so how?

Update edit:

I know its badly written but like I said not really sure how to expain ..:( ok lets try again ...Here is the basic structure as an export..

INSERT INTO `bookmarks` (`id`, `name`, `url`) VALUES
(1, '', 'http://twitter.com'),
(2, '', 'http://digg.com'),
(3, '', 'http://stumbleupon.com'),
(4, '', 'http://reddit.com'),

continued further down...this is where I lose the url but gain the name

(830, 'Twitter', ''),
(831, 'Digg', ''),
(832, 'Stumbleupon', ''),
(833, 'Reddit', '');

I need to add the name row to the 1st part so it becomes

(4, 'Reddit', 'http://reddit.com'),

Merge 2 SQL insert queries

I need to bump the rows/columns up


INSERT INTO `table` (`row2`,`row3`) VALUES ('val1','val2');
0

精彩评论

暂无评论...
验证码 换一张
取 消