MySQL compare to multiple conditions update another table problem

Source: Internet
Author: User
A B c three tables

A data sheet
b for Condition set table BID B1 B2 B3 four fields
C for User table CID UID fields

Statistics a table conforms to 3 conditions A1 A2 A3 Three conditions, these three conditions are statistical user data derived conditions.
Then the UID value updated by the user CID according to the C table

The fact is to update the value of bid with three criteria to the CID of the C table

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

Statistically good $a1 $A 2 $A 33 conditions to compare >=b table B1 B2 B3 value, and then update the bid value of the corresponding condition to the CID of table C

May I ask how this is done? Internal link But the CID of C is only equal to one of the values in table B bid.

What I'm doing now is two SQL statements, 11 queries that match the bid, and the 2nd statement updates the qualifying bid to C
Is there a way to complete a MySQL statement?


Reply to discussion (solution)

You the three tables, only to use 2 tables have corresponding related fields, in accordance with the conditions to check, it is OK, the most important thing is to have the associated field.

Currently only two statements have been completed, and the association should be less likely.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.