SELECT  
 SUM( true ) AS `all`, 
 SUM( IF( `state` = 'new', true, 0 ) ) AS `new`,
 SUM( IF( `state` = 'sale', true, 0 ) ) AS `sale`, 
 SUM( IF( `state` = 'sold', true, 0 ) ) AS `sold`, 
 SUM( IF( `state` = 'call', true, 0 ) ) AS `call`, 
 SUM( IF( `state` = 'done', true, 0 ) ) AS `done` 
 
FROM 
 `sale`
 
WHERE 
  IF( :shape<>'', IF( :shape='all', true, `shape` = :shape ), true )
 
 
