Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Insert subquery error
September 1, 2005, 7:42 pm
rate this thread
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
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
- » How to get all distinct words from many fields of a table
- — Previous thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum