-->

MY-SQL

 

 

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

 

mysql

 

about author

PHRASE

Level 1  라이트

댓글 ( 4)

댓글 남기기

작성