Java 在mysql中创建临时表

Java 在mysql中创建临时表,java,mysql,Java,Mysql,伙计们,可以在mysql的临时表中使用临时表吗?? 当我使用 CREATE TEMPORARY TABLE bo_attribute_description_group_temp ( SELECT id FROM bo_attribute_description_group WHERE display_name IN ('backoffice.attr.group.services', 'backoffice.attr.group.eyecatchergroup') )

伙计们,可以在mysql的临时表中使用临时表吗?? 当我使用

CREATE TEMPORARY TABLE bo_attribute_description_group_temp (
    SELECT id 
    FROM bo_attribute_description_group
    WHERE display_name IN ('backoffice.attr.group.services', 'backoffice.attr.group.eyecatchergroup')
);

select * from bo_attribute_description_group_temp;

CREATE TEMPORARY TABLE bo_attribute_description_temp (
    SELECT id
    FROM bo_attribute_description
    WHERE group_id IN (bo_attribute_description_group_temp)
);
但它给了我

Error Code: 1054. Unknown column 'bo_attribute_description_group_temp' in 'where clause'    0.000 sec

为什么

是的,你可以。必须在第二个create table子查询中使用select子句:

CREATE TEMPORARY TABLE bo_attribute_description_group_temp (SELECT id
                                                        FROM bo_attribute_description_group
                                                        WHERE display_name IN ('backoffice.attr.group.services', 'backoffice.attr.group.eyecatchergroup'));

select * from bo_attribute_description_group_temp;

CREATE TEMPORARY TABLE bo_attribute_description_temp (SELECT id
                                                  FROM bo_attribute_description
                                                  WHERE group_id IN (select id from bo_attribute_description_group_temp));