Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By orkideh on
Hi all
i have table with index on three column to avoid some duplicate cases
now i want to insert data to in and ignore insert if record with index already exist
may any one can help me ?!
Comments
Mysql Query Example to add unique constraint
alter table customers add unique index(user, email, address);
Dear manish i did indexing my
Dear manish
i did indexing
my table already has index
know how to ingore this index in inserting in duplicate cases
index is set but you must set unique index.
index is set but you must set unique index. that;s why i give you a simple solution which alter table and set unique index.
i did, it prevent from
i did,
it prevent from inserting duplicated row, but i show error in each event, i want to solve that without error happening,
i mean each time script faced with duplicate row it prevent from inserting and continue application flow
This will only work if you
This will only work if you are using mysql:
Note that col1, or a combination of col1 and col2, must be the primary key for {some_table}.
thats nice, is it way to
thats nice,
is it way to implement this with some thing like
?!
You can implement it exactly
You can implement it exactly as I showed above.
nice tip Jaypan thanks
nice tip Jaypan thanks