I have a query that I execute with CREATE TEMPORARY TABLE AS SELECT because for the life of me I can't figure out how to write it as one query, hoping someone can show me how to eliminate the CREATE TEMPORARY TABLE AS.
My data:
monitor table:
date | ip | webid | userid | compid
SQL
CREATE TEMPORARY TABLE temp AS
SELECT webid, userid, COUNT(ip) AS total, COUNT(DISTINCT ip) AS uniq FROM monitor
GROUP BY webid, userid;
SELECT SUM(total), SUM(uniq) FROM temp;
The two sums for total/uniq after it's been grouped, are all I really need but as mentioned I'd like to eliminate the step of creating the table.
thanks in advance for any help.