It has been around for a while. At the beginning ''''''
The difficulty is mainly in programming languages, arrays, logic, algorithms ,...
After these steps, the difficulties will rise to the database design.
And Data logic.
An excellent system will integrate excellent programs and excellent database design.
Enough experience is needed to achieve this.
This is a nested query that I wrote combined with uinon.
Put the five reports in a temporary table, and then from the temporary table
The data to be queried.
$ SQL = "select type, sum (yjsl) as yjsl, sum (yysl) as yysl, sum (jyrs) as jyrs, sum (jycs) as jycs
From (
Select C. MC
Type, count (D. lsh) as yjsl, 0 as yysl, 0 as jyrs, 0 as jycs
From sys_dzxxb as B, sys_jcb as C, sys_dzyjb as d
Where B. BM = C. lsh
And D. dzlsh = B. lsh
Group by C. MC
Union select C. MC
Type, 0 as yjsl, count (E. lsh) as yysl, 0 as jyrs, 0 as jycs
From sys_dzxxb as B, sys_jcb as C, sys_dzyy as E
Where B. BM = C. lsh
And E. dzlsh = B. lsh
Group by C. MC
Union select C. MC
Type, 0 as yjsl, 0 as yysl, count (distinct E. dzlsh) as jyrs, 0 as jycs
From sys_dzxxb as B, sys_jcb as C, sys_ltxxb as E
Where B. BM = C. lsh
And E. dzlsh = B. lsh
Group by C. MC
Union select C. MC
Type, 0 as yjsl, 0 as yysl, 0 as jyrs, count (distinct E. lsh) as jycs
From sys_dzxxb as B, sys_jcb as C, sys_ltxxb as E
Where B. BM = C. lsh
And E. dzlsh = B. lsh
Group by C. MC
) As temptable
Group by type ";
Share with you.