Arthur,
I suspect you could create an aggregate function to do it the same way that
avg() works more or less.
John Henderson

>Was wondering if there was a way to use an aggregate value in a single
>select query to make a calculation within that query...
>
>Example:
>Table has column bool of type boolean with various random boolean
>values.
>
>Want to see if it is possible (in a single select query) to find the
>percentage of entries in the table that are true.
>
>(SELECT count(*) FROM table WHERE bool='t') / (SELECT count(*) FROM
>table)
>
>I know that the above query doesn't work, but is just shown for
>reference and formula sake.  If anyone can help, it would be greatly
>appreciated.  Even a simple "No, it can't be done in a single query" is
>help enough.
>
>Thanks!
>
>Arthur
>
>

Reply via email to