I have as part of an SQL Query
SELECT
TransID,
SUM(isSatisfactory) as SatTr,
count(AllTrades.AllTradeIndex) as AllTr,
(SUM(isSatisfactory) / count(AllTrades.AllTradeIndex) ) * 100 as RatioOf
FROM
...Several subqueries here...
GROUP BY TransID
The results are
strTransID SatTr AllTr RatioOfGoodAccounts
307319906 6 12 0
If I select the columns without the group and math, this is the result set
strTransID isSatisfactory AllTradeIndex
307319906 NULL 1334036
307319906 NULL 1334037
307319906 NULL 1334038
307319906 NULL 1334039
307319906 NULL 1334040
307319906 1 1334041
307319906 NULL 1334042
307319906 1 1334043
307319906 1 1334044
307319906 1 1334045
307319906 1 1334046
307319906 1 1334047
I thought perhaps the nulls was messing it up, but I tried coalesce and it didn't affect the results.