Hi there,
I having a problem with a MySQL INSERT … SELECT statement:
INSERT INTO
`products`
(
`id`,
`image`,
`title`,
`description`,
`price`,
`VAT`,
`related_products`
)
SELECT
'CR25',
`id` FROM `images` WHERE `images`.`title` = 'Some Image Title',
'Product Title',
'Product Description',
4.99,
0,
'CR26'
Throws an error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’ ‘Product Title’
I’ve also tried
INSERT INTO
`products`
(
`id`,
`image`,
`title`,
`description`,
`price`,
`VAT`,
`related_products`
)
VALUES
(
'CR25',
(`id` FROM `images` WHERE `images`.`title` = 'Some Image Title'),
'Product Title',
'Product Description',
4.99,
0,
'CR26'
)
But I get a similar error message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’ ’
As far as I can tell I’m using the correct syntax.
Any ideas?
Cheers
M