Fixed search sql.