Multiple on duplicate update

hello people

first of all let me explain what im trying to do… every time somebody hits a page on my site refered from google i extract the keywords and i want to add them to a database with the url

so if i have a table called urls with the following cells


what i want is if the url and keyword combination already exists update hitcount+1 if not insert the new url and keyword into the table.

is it possible to do this with mysqls “on duplicate update” feature or do i need to use multiple queries.


is it possible to have two unique cells joined so its only unique if both cells dont match?

hope you understand this… its a bit hard to explain

looking forward to your possible solutions :slight_smile:

absolutely, it’s a classic example

absolutely, declare a UNIQUE index on both columns, i.e. a multi-column index