saurav99990 Posted May 12, 2015 Share Posted May 12, 2015 We use (INSERT INTO) to insert a record in the table which creates more than one record when used again. Is there any way to add a record and alternately replacing the prevoius one without adding any new record. I know this would work: UPDATE Customers SET ContactName='Alfred Schmidt', City='Hamburg'WHERE CustomerName='Alfreds Futterkiste'; But what if there is no condition ie. we don't know the record, we only know the column name. Is there any way to fill only one record and alternately replace the previous record without creating 2nd record? Quote Link to comment https://forums.phpfreaks.com/topic/296260-need-help-in-sql/ Share on other sites More sharing options...
Barand Posted May 12, 2015 Share Posted May 12, 2015 Have a look at INSERT ... ON DUPLICATE KEY UPDATE ... statements http://dev.mysql.com/doc/refman/5.6/en/insert-on-duplicate.html Quote Link to comment https://forums.phpfreaks.com/topic/296260-need-help-in-sql/#findComment-1511626 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.