SELECT i_State, n, ROUND( n / s * 100, 4 ) rat FROM ( SELECT * FROM ( SELECT i_State, COUNT( 1 ) n FROM planinfo GROUP BY i_State ) t1 INNER JOIN ( SELECT COUNT( 1 ) s FROM planinfo ) t2 ON 1 = 1 ) t
SELECT i_State, n, ROUND( n / s * 100, 4 ) rat FROM ( SELECT * FROM ( SELECT i_State, COUNT( 1 ) n FROM planinfo GROUP BY i_State ) t1 INNER JOIN ( SELECT COUNT( 1 ) s FROM planinfo ) t2 ON 1 = 1 ) t