I'm baffled. Given the table defs below, the following query returns an
error (ERROR 1136 (21S01): Column count doesn't match value count at row 1):
mysql> insert into b (blue, green) values((SELECT red, alpha from a
WHERE red=1));
Obviously I'm doing something wrong, but what? How to make it work?
For now I did a:
INSERT INTO b SET
blue=(SELECT red FROM a WHERE red=1),
green=(SELECT alpha FROM a WHERE red=1);
Not very efficient or pretty...
CREATE TABLE `a` (
`red` int(11) default NULL,
`alpha` int(11) default NULL
);
CREATE TABLE `b` (
`blue` int(11) default NULL,
`green` int(11) default NULL
);