Mysql compared to the problem of updating another table with multiple conditions
A B C three tables
Data Table
B sets the BID B1 B2 B3 fields for the condition.
C is the cid uid field of the user table.
Table A meets the three conditions A1 A2 A3. these three conditions are the conditions for collecting user data.
Then, according to the UID value updated by the CID in Table C
In fact, the BID value that meets the three conditions is updated to the CID of table C.
Conditions set in Table B
BID = 1 B1 = 10 b2= 100 B3 = 180
BID = 2 B1 = 30 b2= 150 B3 = 200
BID = 3 B1 = 50 b2= 180 B3 = 230
Compare the three statistical conditions $ A1 $ A2 $ A3> = B1 B2 B3 value in Table B, and update the BID value of the corresponding condition to CID in Table C.
How can I do this? But the CID of table C is equal to only one value of Table B's BID.
My current practice is to use two SQL statements, one is to query the BID that meets the condition, and the other is to update the BID that meets the condition to C.
Is there a way to complete a mysql statement?
Reply to discussion (solution)
You only have two associated fields for the three tables. you just need to check them according to the conditions. The most important thing is to have associated fields.
Currently, only two statements are completed, and association is unlikely.