These are the tables i have (simplified):
mytable
--------------------
`pid` int(11) NOT NULL AUTO_INCREMENT
`mydate` date NOT NULL,
pictures
--------------------
`pid` int(11) NOT NULL AUTO_INCREMENT
`image_name` varchar(255)
pictures_2014
--------------------
`pid` int(11) NOT NULL AUTO_INCREMENT
`image_name` varchar(255)
This is the code i have:
SET AUTOCOMMIT=0;
START TRANSACTION;
SELECT @pids := GROUP_CONCAT(CONVERT(pid , CHAR(8)))
FROM `mytable`
WHERE `mydate`
BETWEEN '2014-01-01'
AND '2014-10-31';
INSERT INTO pictures_2014 SELECT * FROM `pictures` where pid in(@pids);
COMMIT;
Only one item is being inserted into pictures_2014, the first item in the comma separated list.
The result I expect is all 4111 rows that match my first query (at least those in pictures
) will be copied.
I do know that at least the first 6 pids in the group_concat shown in phpmyadmin exist in the table pictures
I also tried adding LIMIT 0,100 to my first query to see if it was a variable length issue but i still only get one result.