Forum Moderators: coopster
I am having trouble with performing an INSERT, from SELECTED data.
The following query i can get to work fine:
INSERT INTO months_domains ( MonthDomainID, MonthHits )
( SELECT domains.DomainID, domains.DomainHits FROM domains )
But when i try to add a value not retrieved from the select statement, i can't keep the query legal. Below is my attempt
INSERT INTO months_domains ( MonthDate, MonthDomainID, MonthHits )
( '26-5-2005', ( SELECT domains.DomainID, domains.DomainHits FROM domains ) )
any help appreciated
cheers
Try putting the date into the "SELECT" statement ...
(SELECT '26-05-2005', domains.DomainID, domains.DomainHits FROM domains))
Or use one of the date functions like CURDATE() to generate the correct date. It may also be complaining about not using 2 digits for the month in your date string.