Skip to content
Advertisement

How to select and update row, so that the same row could not be selected again by any user?

I am sending sms to mobile numbers using many apis at the same time, now I want to ensure that only one sms should be sent to one mobile number.

I am selecting a row using the following query

while selecting the row I want to set field i_sms_sent_count to 1 so that this row could not be selected again by any user.

Advertisement

Answer

One method is to do the update and then get the values. Assuming you have a contact_id column:

Then get the information:

EDIT:

An alternative is:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement