Query to find Skew Factor of Tables Having Count >1000

Database
Enthusiast

Query to find Skew Factor of Tables Having Count >1000

Hi ,

I need to get the skew factor of those tables whose count is greater than 1000. As below query is giving me 5-6 outputs how can i use the output table name in below Query.

SELECT 

databasename,TABLENAME,

(100 - (AVG(CURRENTPERM)/MAX(CURRENTPERM)*100) (FORMAT 'zz9.99') ) AS SKEWFACTOR,

cast (CURRENT_date as timestamp(0)) + ((current_time -time '00:00:00') hour to second(0)) As AS_ON

FROM 

DBC.TABLESIZE 

where  DATABASENAME like ( 'dev%_STG%')

having SKEWFACTOR >=90

GROUP BY 1,2;

Thanks.!