I want to retrieve this kind of table in my sql:
Type Qad (type count) Correct(No. of item without error) Accuracy(%)
type 1 3 3 100
type2 6 3 50
I am curretly trying to use this query but it has an error:
SELECT `type` AS 'ReturnType', COUNT(*) AS 'QAd',
(SELECT COUNT(*) FROM bartran WHERE QASample='2' AND QAErrorID='1' AND `type`=ReturnType AND TimefileDate BETWEEN '2012-01-01' AND '2012-12-31' AS 'Correct',
(SELECT COUNT(*) FROM bartran WHERE QASample='2' AND QAErrorID='1' AND `type`=ReturnType AND TimefileDate BETWEEN '2012-01-01' AND '2012-12-31') / COUNT(*) * 100) AS 'Accuracy'
FROM bartran WHERE QASample='2'
AND TimefileDate BETWEEN '2012-01-01' AND '2012-12-31'
GROUP BY TYPE;
I'm current new to this one, hope someone helps me with this. thanks!!