CodePudding user response:
Make a judgment, not counted as zero, a value calculated togetherCodePudding user response:
Suggested the building list table structure, and provide the test data, and based on these test data that corresponds to the correct result,Refer to the way the post questions http://bbs.csdn.net/topics/320211382
So people who want to help you to build the same environment with you directly, and in providing the test before, avoid the error in the text understanding,
CodePudding user response:
SELECT(SELECT SUM (t1) amount) FROM ordinary consumption table t1 WHERE t1. The consumption date=?) +
(SELECT SUM (t2) amount) FROM member consumption table t2 WHERE t2. The consumption date=?) The FROM DUAL;