临时表不存在

bf1o4zei  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(218)

我正在尝试从试探性2获取总行数,但错误为“关系”试探性2“不存在”

select
  (
    select count(*) from tempTable2
    where (EXTRACT(EPOCH FROM (maxdailylog - mindailylog))/3600)>4.5
  ) as totalHadir,
  (
    select count(*) from tempTable2
    where (EXTRACT(EPOCH FROM (maxdailylog - mindailylog))/3600)<4.5
  ) as absenTidakKomplit
from
  (
    select LogHari, mindailylog, maxdailylog, count(LogHari) as jumlahLog from(
       select waktuabsen::date as LogHari,
         min(waktuabsen) over (partition by userid, waktuabsen::date) as mindailylog,
         max(waktuabsen) over (partition by userid, waktuabsen::date) as maxdailylog,
         dense_rank() over (order by waktuabsen::date) as grouplistno
       from sdm.tabsen
       where userid=866 and waktuabsen >= '2020-03-01T00:00:00' and waktuabsen < '2020-03-31T00:00:00'
      ) as tempTable
      group by grouplistno, LogHari, mindailylog, maxdailylog
  ) as tempTable2
j8yoct9x

j8yoct9x1#

可以从创建临时表的会话中访问临时表。对于其他任何会话,它们都不可用。尝试在创建临时表的同一窗口或同一会话中运行查询

相关问题