If you have any questions about mysql Query, we will send you 100 points.
Source: Internet
Author: User
Ask A mysql Query question. in this post, SHANDIANDIAN will edit table A & nbsp; & nbsp; & n for a mysql Query question, 100 points
At the end of this post, SHANDIANDIAN edited Table A in Table B at 12:15:27 on.
Uid mid cash number
1 1 100 1 101 100
2 2 105 2 1 100 100
3 3 98 3 2 105 200
4 4 55 4 2 105 300
5 5 60 5 3 60 300
6 6 70 6 3 98 300
Uid is the auto-increment field. mid and cash are the associated fields.
I want to calculate the sum quantity of Table B as shown below. if Table A does not match, the result is 0, and the matching result is through the mid and cash fields. How can I write SQL statements ?? Base Table
Result table
Uid mid cash number
1 100 100
2 2 105 500
3 3, 98, 300
4 4 55 0
5 5 60 0
6 6 70 0 Share: More
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