Extra where clause is needed
Trev,
If you narrow your selection to retrieve total_rows, you should also narrow the selection of the complains to that period of time. Then you should come up with correct percentages. So , al you need to do is add an extra where clause.
SELECT a.complaint_cause,
ROUND(COUNT(a.complaint_cause)/b.total_rows *100 ,2)
FROM complaints a,
(SELECT COUNT(ROWID)total_rows
FROM complaints
WHERE date_entered
BETWEEN '01-October-00'
AND '15-October-00') b
WHERE a.date_entered
BETWEEN '01-October-00'
AND '15-October-00'
GROUP BY a.complaint_cause, b.total_rows;
Let me know if this worked.
Kind regards,
SLAM.