How can I show percent for every row?

I have a query like this:

SELECT TRUNC(DATE) - TRUNC(TO_DATE(REGEXP_SUBSTR(FILE, 'd{12}', 1, 1),'YYYYMMDDHH24MI))
AS DAYDIFF, COUNT(1) AS TOTALFILE
FROM TABLE
WHERE DATE BETWEEN to_date('20.05.2015 00:00:00','DD.MM.YYYY HH24:MI:SS')
and to_date('22.05.2015 18:00:00','DD.MM.YYYY HH24:MI:SS')
GROUP BY TRUNC(DATE) - TRUNC(TO_DATE(REGEXP_SUBSTR(FILE, 'd{12}', 1, 1),'YYYYMMDDHH24MI))
ORDER BY DAYDIFF

Return like this:

enter image description here

I need to show percent(row/sum(totalfile)*100) every row like this:

enter image description here

How can I do this?


Source: sql

Leave a Reply