嗨,我正在做一个项目,我正在尝试的是,我想将使用 select 语句得到的记录插入到临时表中。但它给我带来了错误,任何人都可以帮我解决这个问题吗?
错误:关系“temp_mytbl”不存在 SQL 状态:42P01
以下是我的查询
truncate table temp_mytbl;
create temporary table temp_mytbl as
select iex_id,dte,agent_name,schd_total
FROM source_xrx_iex6_sandy_1.iex6_agent_adh_sum limit 0;
insert into temp_mytbl
select iex_id,dte,agent_name,schd_total
FROM source_xrx_iex6_sandy_1.iex6_agent_adh_sum
group by iex_id,dte,agent_name,schd_total;
SELECT i.dte,
idm.empl_id,
1 AS entity_id,
sum(i.schd_total) AS s_schdhours
FROM temp_mytbl i
JOIN source_odw_usac.t_incontact_agentstatelog a ON a.winid = i.iex_id::text
JOIN reporting_prod.idm_dte idm ON idm.src_id = a.agent_no AND idm.src_type_id = 618 AND soar_date(a.calendar_date_key) >= idm.start_dte AND soar_date(a.calendar_date_key) <= COALESCE(idm.end_dte, now()::date)
GROUP BY i.dte, idm.empl_id limit 100;
或子查询形式相同