I want to make an 2 way select verification for all users in that kind of code version:

select * from table_A where other_user_id='B'
if (1) -> update set response_A='1'
if (0) -> select * from table_B where other_user_id='A'
  if (1) -> update set response_B='1'
  if (0) -> insert into table_A (response_A) values ('1') where other_user_id='B'

it is the reason to have less db entries and make the db queries faster/thiner, because not all users would have all information of each others in there own table. the problem what i see is i am not sure if that will creates me doubles. lets say. user A do that on same millisecounds as user B does on different computers. then the db create doubles (right?) because the db does not wait for the full query. is there an better way how to handle that? can and how can i stop for user B for that time that the db needs to make that for user A? thx and br

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.