SELECT 
 * 

FROM 
 `visit`
 
WHERE 
  NOT( ( `ip` IS NULL ) OR ( `ip` = '' ) ) 
 AND 
  IF( :role<>'', IF( :role='all', true, `role` = :role ), true )
	
ORDER BY
 `created` DESC
 
LIMIT 
 :limit 
 
OFFSET 
 :offset	