Why can I not create a temporary table then immediately JOIN against it?
mysql> CREATE TEMPORARY TABLE table2 as (select in_reply_to_id, COUNT(in_reply_to_id) as C from mentions where in_reply_to_id>0 group by in_reply_to_id);
Query OK, 57149 rows affected (0.14 sec) Records: 57149 Duplicates: 0 Warnings: 0
mysql> select T.tweet_id, T.favorite_count, T.retweet_count, T2.C from
-> tweets AS T JOIN table2 AS T2
-> on T.tweet_id = T2.in_reply_to_id;
ERROR 1146 (42S02): Table 'twitter_analysis.table2 as' doesn't exist mysql>
But it does exist because I can select from it!
select count(*) from table2;
57149 1 row in set (0.01 sec)
This error is extremely frustrating. Is there a way to put this temp table into the select query?