SQL MS access count more than columes with three where -
i have problem type sql statement have more columns, row , need utilize , count, result don't know how can write sql statement.
name|total| er | opd | ipd wbc | 5 | 2 | 3 | 0 plt | 3 | 1 | 0 | 2 mcv | 7 | 4 | 2 | 1 select count(wbc) total, (select count(wbc) table2 section='er') er, (select count(wbc) table2 section='opd') opd, (select count(wbc) table2 section = 'ipd') ipd table2 ;
second row
select count(plt) total, (select count(plt) table2 section='er') er, (select count(plt) table2 section='opd') opd, (select count(plt) table2 section = 'ipd') ipd table2 ;
and 3rd row
select count(mcv) total, (select count(mcv) table2 section='er') er, (select count(mcv) table2 section='opd') opd, (select count(mcv) table2 section = 'ipd') ipd table2 ;
try this:
select name, total, er, opd, ipd from( select 1 order, 'wbc' name, count(wbc) total, (select count(wbc) table2 section='er') er, (select count(wbc) table2 section='opd') opd, (select count(wbc) table2 section = 'ipd') ipd table2 union select 2, 'plt', count(plt) total, (select count(plt) table2 section='er') er, (select count(plt) table2 section='opd') opd, (select count(plt) table2 section = 'ipd') ipd table2 union select 3, 'mcv', count(mcv) total, (select count(mcv) table2 section='er') er, (select count(mcv) table2 section='opd') opd, (select count(mcv) table2 section = 'ipd') ipd table2 ) u order u.order
sql ms-access
No comments:
Post a Comment