|Subject||Re: [firebird-support] SQL query help|
> I have a table column that stores the characters 'Y' or 'N'.e.g.
> I am trying to write a query that returns the number of 'Y's I have in
> relation to the total number of 'Y' and 'N' occurences.
> So if the column had Y,Y,Y,Y,N it would return 80 (%) or even
> something like 4,5 so that I can have the total number of 'Y's and the
> total number of rows.
select count(*), myfield
group by myfield;
select count(*), count(case when myfield='Y' then 1 end)
select count(*), count(nullif(myfield, 'N'))