CREATE TEMPORARY TABLE `winapi` (
 `module` VARCHAR( 255 ) NOT NULL ,
 `stubs` INT NOT NULL ,
 `total_func` INT NOT NULL ,
 `real_stub` INT NOT NULL ,
 `psedo_stubs` INT NOT NULL ,
 `forwards` INT NOT NULL ,
 PRIMARY KEY ( `module` ) 
);

LOAD DATA LOCAL INFILE "winapi_stats,dat" REPLACE INTO TABLE winapi
FIELDS TERMINATED BY "~"
LINES TERMINATED BY "\n";

SELECT "Total" "Library", sum(total_func) "API Count", 
(sum(total_func) - sum(stubs)) / sum(total_func) *100 "% implemented", sum(stubs) "Total Stubs", sum(real_stub), sum(psedo_stubs)
FROM winapi
UNION ALL
SELECT module "Library", total_func "API Count", (
total_func - stubs
) / total_func *100 "% implemented", stubs "Total Stubs", real_stub, psedo_stubs
FROM winapi;
