INSERT...ON DUPLICATE ROW
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
INSERT...ON DUPLICATE ROW
Is there any MYSQL Syntax that will allow me to Insert records and Either append or update records based on the matching values of a ROW rather than a UNIQUE or PRIMARY KEY?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Re: INSERT...ON DUPLICATE ROW
Well I knew about this but the thing is the primary Key is a auto incremented and the other columns can contain duplicates. The data is not going to have the auto incremented field. So i need to match the VALUES of the WHOLE ROW except the auto increment column.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: INSERT...ON DUPLICATE ROW
I don't fully understand what you are trying to do.
If a row matches exactly with some input you have, you want to update? This will involve two queries.
If a row matches exactly with some input you have, you want to update? This will involve two queries.
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Re: INSERT...ON DUPLICATE ROW
yeah thought so...Jcart wrote:I don't fully understand what you are trying to do.
If a row matches exactly with some input you have, you want to update? This will involve two queries.
the client is extracting data from a database for my cron job to insert into mysql...they are lazy and rather than just give me the new data...they are giving me data that may contain redundant records. I had a unique id that i could have used but they have sinced changed thier format and no not only do i have to append new information but I will need to identify changes in the old data to have it updated where necessary..
sigh...clients....