Non distinct Unique ID in MySQL database table.

Posted by Geoff on Stack Overflow See other posts from Stack Overflow or by Geoff
Published on 2010-05-25T16:02:06Z Indexed on 2010/05/25 16:11 UTC
Read the original article Hit count: 341

Filed under:
|
|

First of, a simplified version: I am wondering if I can create a trigger to activate during INSERT (it's actually LOAD DATA INFILE) and NOT enter records for an RMA already in my table?

I have a table that has no records that are unique. Some may be duplicates but there is one field that I can use to know if the data has been entered or not. For instance

RMA     Op     Days
---------------------
213   Repair   0.10
213    Test    0.20
213   Repair   0.10

So I could do an index on the three columns together but as you see it's possible for an RMA to be in a step for the same amount of time twice so it's possible to have duplicate records. This data comes from a report that I cannot edit and this is all it provides. The key is that an RMA's data is only in the report once so if my database already has that RMA in it's records I want to skip the loading of that RMA's records from the report.

By all means please let me know if that didn't make sense, I'll Explain as needed. I'm sure it's not uncommon but I couldn't find anything on the net.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about trigger