larrydavid
Programmer
Hello,
IN SS2005, I am trying to calculate a percentage column based on counts from two tables:
With the above query I am returning 0. I've been through several forums and my understanding is I need an outer query, for instance with a derived table or cte. Then convert the result to varchar and add a '%' to the result. Am I on the right track? If someone could show me an example I would so greatly appreciate it.
Thanks,
Larry
IN SS2005, I am trying to calculate a percentage column based on counts from two tables:
Code:
SELECT [Dispute Rate] = (SELECT count(*) FROM TEST1 WHERE RECEIVED_DATE > 1/1/2011) / (SELECT count(*) FROM TEST2) * 100,
FROM TEST t INNER JOIN
TEST2 t2 ON t.CLAIMNO = t2.CLAIMNO INNER JOIN
WHERE TEST1.PAIDDATE > '20110101'
With the above query I am returning 0. I've been through several forums and my understanding is I need an outer query, for instance with a derived table or cte. Then convert the result to varchar and add a '%' to the result. Am I on the right track? If someone could show me an example I would so greatly appreciate it.
Thanks,
Larry