1 2 3 4 5 6 7 8 9 | SET @totalCount := ( SELECT count (fid) FROM files); SELECT f.file_type, @totalCount AS totalCount , count (fid) AS count , ROUND(( count (fid)*100)/( @totalCount)) AS percent FROM files f GROUP BY f.file_type |
SELECT f.file_type, @totalCount AS totalCount , count(fid) AS count , ROUND((count(fid)*100)/(SELECT count(fid) FROM files)) AS percent FROM files f GROUP BY f.file_type
댓글 ( 4)
댓글 남기기