I have seen some questions with a similar title but they do not answer my question
I have one table like this
id original from_lang translated to_lang ranking
1 word1 es trans1 en 0
2 word1 es trans2 en 1
...
id
column is a UNIQUE PRIMARY KEY
with AUTOINCREMENT
The rest of the columns can not be unique
What I try to do: When I insert a new row, if the original
column and from_lang
column and ranking
column are the same then update existing row but if not the same then insert a new entry row
I have tried this
INSERT INTO words
(original, from_lang, translated, to_lang, ranking)
VALUES
('word1','es','trans3','en',0)
-- ... here is mi problem because I don't know how to use
-- ON DUPLICATE KEY UPDATE in my case that I have not UNIQUE columns
But the above query insert a new row
Espected:
Update first row where id = 1