Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Lehre:AUF DUPLICATE KEY UPDATE

für Symfony 2 Verwenden Sie rohes SQL:

$em->getConnection()->prepare("INSERT INTO table SET 
    some_fields = "some data", created_at = NOW() 
    ON DUPLICATE KEY UPDATE
    some_fields = "some data", updated_at = NOW()
")->execute();