2016-05-22 11 views

答えて

2

あなたは、おそらくこのような何かを探している:

select 
    Table, 
    sum(case when Operacion = 'INSERT' then 1 else 0 end), 
    sum(case when Operacion = 'DELETE' then 1 else 0 end), 
    sum(case when Operacion = 'UPDATE' then 1 else 0 end) 
from 
    xxx 
group by 
    Table 
0

あなたはこのようなものを探していますか:

select a.tabla,a.insertCount,b.updateCount,c.deleteCount 
from (select 
     Tabla, 
     count(*) as insertCount 
    from table 
    where Operation = 'INSERT' 
    group by 
     Tabla)a, 

(select 
     Tabla, 
     count(*) as insertCount 
    from table 
    where Operation = 'UPDATE' 
    group by 
     Tabla)b, 

(select 
     Tabla, 
     count(*) as deleteCount 
    from table 
    where Operation = 'DELETE' 
    group by 
     Tabla)c 
where a.tabla=b.tabla and b.tabla=c.tabla 
関連する問題