SELECT 
 * 
 
FROM 
 `sale` 
 
WHERE  
  IF( :state<>'', IF( :state='all', true, `state` = :state ), true )
 AND 
  IF( :shape<>'', IF( :shape='all', true, `shape` = :shape ), true )
 AND 
  IF( :form<>'', IF( :form='all', true, `form` = :form ), true )

ORDER BY
 `created` DESC
 
LIMIT 
 :limit 
 
OFFSET 
 :offset
 
