SELECT 
 * 

FROM 
 `visit` 

WHERE 
  `ID` = :ID 
 AND 
  NOT( `ip` IS NULL )