It's been a while, at the beginning.
The difficulty is mainly in programming languages, arrays, logic, algorithms,...
After all this has come, the difficulty has risen to the database design.
and data logic.
An excellent system that integrates excellent programs and excellent database design.
This should be done with sufficient experience.
This is a nested query that I wrote with a combination of Uinon.
Put five aspects of the report into a temporary table, and then from the temporary tables, will be the data to query out.
Copy Code code as follows:
$sql = "Select Type, sum (YJSL) as Yjsl, sum (YYSL) as YYSL, sum (jyrs) as jyrs, sum (JYCS) as Jycs
From (
SELECT C.MC as
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 as
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 as
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 as
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 to everyone.