I\'d like to combine an insert query with a \"where not exists\" so as not to violate PK constraints. However, syntax such as the following gives me an Incorrect synta
mysql has the insert ignore query:
If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued. Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort. You can determine with the mysql_info() C API function how many rows were actually inserted into the table.
http://dev.mysql.com/doc/refman/5.0/en/insert.html
ON DUPLICATE KEY UPDATE is also available