0

What I'd like to say is something like:

Update a count by 1 if an id exists add it if not.

I have tried the following:

INSERT INTO links (id, count) VALUES (:id, 1)
       ON DUPLICATE KEY UPDATE count = count + 1;

which is some PHP code, I can add the ids, but I can't increment the count. Any ideas please?

Niels Keurentjes
  • 39,856
  • 8
  • 91
  • 133
user1408643
  • 731
  • 2
  • 7
  • 14

0 Answers0