johanafm;10929464 wrote:Are all those fields present when the user submits data? And are those three fields the primary key?
If so, INSERT ... ON DUPLICATE KEY ...
If you only lack the primary key you can also create a unique index on those three fields.
The Primary Key exists in the table itself for 'internal' purposes, but it doesn't exist in the data that a user will upload. I want to identify which data they are uploading is duplicate data and may contain amendments, and which data is new data and should simply be added in at the bottom.
The way I see it is that the closest i can get to a unique identifier is the combination of order reference and item number (as this combination cannot possibly be repeated, and exists in both places).
The problem I have is how to use this information to both amend existing lines and add new lines.
if I use "INSERT ... ON DUPLICATE KEY ..." can i specify several fields, the combination of which must be unique, to be the identifier for the data that will be overwritten?
Many Thanks for your help
Silas