Home > database > About the more child query, one of them is empty, the all data all have no, how to solve this proble
About the more child query, one of them is empty, the all data all have no, how to solve this proble
Time:10-05
About the more child query, one of them is empty, the all data all have no, how to solve the problem of the
Select * from (select f1 from t1 where... ) a1, (select f1 from t1 where... ) a2, The from t2 (select f1 where... A3, .
If there is no record of a1, even other sub queries, the main query didn't count, I think whether or not the subquery is there a number, as long as there is record, other sub queries can get, how to solve?
CodePudding user response:
The building Lord gives some test data, and your expected results, didn't see you want to achieve what kind of effect;
CodePudding user response:
The need to make sure that a piece of the main table, it means that there must be a data, the other may not, associated with outside connection line Anderson, d=b.i d (+) and Anderson, d=c.i d (+) If can not, can use multiple union two two imprison LianZha it,
CodePudding user response:
Table t1 F1 rq 10 the 2016-10-13 F2 rq 20 2016-10-11
Select a1. F1, a1. F1 - a2. F1 from (select f1 from t1 where rq='2016-10-13') a1, (select f1 from t1 where rq='2016-10-12') a2
The 12th day no data, as a result, the main query didn't record I don't think to realize even 12 data, but still can get data from 13, namely get 10