Forum Moderators: open

Message Too Old, No Replies

MySQL :: How to return update value?

INSERT INTO a (b,c) VALUES (x,y) ON DUPLICATE KEY UPDATE c=c+1

         

majjk

8:00 pm on Aug 8, 2008 (gmt 0)

10+ Year Member



I'm doing the following:

INSERT INTO ordernumber (id,count) VALUES (123,1) ON DUPLICATE KEY UPDATE count=count+1

what I would like to know is what the "count" value is after this operation. is it possible to include some kind of SELECT in this query so that I will know what the "count" value is in the end?

ideas?

ZydoSEO

2:59 am on Aug 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Have you tried:

INSERT INTO ordernumber (id,count) VALUES (123,1) ON DUPLICATE KEY UPDATE count=count+1

SELECT ROW_COUNT();

See ROW_COUNT() function description [dev.mysql.com...]