Subject Re: [firebird-support] Help finding records
Author Alan J Davies
Try this
select count(*) from customer
where substr(fname,1,1) not between upper('A') and upper('Z')
gives you the count

select fname from customer
where substr(fname,1,1) not between upper('A') and upper('Z')
order by fname
gives you the records

Alan

Alan J Davies
Aldis


On 01/08/2013 15:20, ASOrg wrote:
>
> Dear All
>
> select count(*) from customer ( returns 235384 )
>
> select count(*) from customer where substring(upper(fname) from 1 for 1
> ) in ('A','B','C',
> 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z')
> ( returns 187671 )
>
> so there are 47.713 records whose fname started with letter A-Z.
>
> select distinct ascii_val(substring(upper(fname) from 1 for 1 )) from
> customer where substring(upper(fname) from 1 for 1 ) not in
> ('A','B','C',
> 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z')
> ( returns 0, 13, 46 )
>
> select count(*) from customer where ascii_val(substring(upper(fname)
> from 1 for 1 )) in (0,13,46) ( returns 38197 )
>
> I don't know how to find the other 9516 records.
> Help please ?
>
> Thank you in advance
>
>