Portal Home > Knowledgebase > Articles Database > MySQL command not working. Why?

MySQL command not working. Why?

Posted by FinalFrontier, 11-28-2011, 10:30 AM
Can someone please tell me why this isn't working? http://i44.tinypic.com/xpneo7.png

Posted by mike86, 11-28-2011, 11:28 AM
You cannot do an insert with a where statement. If you are trying to insert everything that is the same where service = 'epp', then do that and just insert 13.40 as domestic. INSERT INTO deliveryservices (service, domestic, zonea, zoneb, zonec, zoned, maxweight) SELECT service, 13.40, zonea, zoneb, zonec, zoned, maxweight FROM deliveryservices WHERE service = 'epp'

Posted by FinalFrontier, 11-28-2011, 11:31 AM
Nah, you can use INSERT and WHERE together. I don't know what to make of your example code dude. :\

Posted by mike86, 11-28-2011, 11:36 AM
You want an update, if you are changing the value of the epp row. UPDATE deliveryservices SET domestic = 13.40 WHERE service = 'epp' Insert is used to put a new row in the table.

Posted by 8088, 11-28-2011, 07:48 PM
If you would've followed the advice 'check the manual' that was given with the error, you would've known that this is simply not true. At least not unless you use a subquery like in mike86's example. How about this then:

Posted by Wes0805, 11-28-2011, 09:06 PM
it's like you're doing an UPDATE rather than an INSERT, follow what mike86 posted above

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
vps for vpn (Views: 411)