Home > database >  The SQL query problem mysql
The SQL query problem mysql

Time:09-29


t_bas_cleanreport project list AT_bas_consultation institutions table B

Correlation of a. consultation_id=B.i d

Project table a. content_flag field content stage classification (assessment phase - pg, acceptance stage - ys)

How to query the institutions involved in the assessment phase project number acceptance stage project total number

CodePudding user response:

Is there a sink -- --

CodePudding user response:

 SELECT institutions, 
The SUM (CASE a. content_flag WHEN "pg" THEN 1 END) AS the assessment phase project number,
The SUM (CASE a. content_flag WHEN 'ys' END THEN 1) number of projects AS acceptance stage,
Count (*) as the total number of
The from t_bas_cleanreport A,
T_bas_consultation B
WHERE a. consultation_id=B.i d
GROUP BY agency
  • Related