If U are using ORACLE 8i, then only need the following:

SQL> select a, trunc( ratio_to_report(count(a)) over() * 100, 2) as percentage
from test
group by a;

A PERCENTAGE
------------ ----------
black 16.66
blue 33.33
red 50

And finally put where condition before the group thing, let me know if it does work for U.



[Edited by mber on 10-11-2000 at 04:31 PM]