派生表不存在-mysql错误1146(42s02)

rdrgkggo  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(217)

我试图在mysql中构建一个群组分析,并遇到了以下问题。我正在联机编译器中运行代码(https://paiza.io).
到目前为止我已经创造了 sups 以及 ords 表和下面的查询开始:

select coh_nos.coh_week, coh_nos.id as coh_items
from
(select 
     WEEK(sup_timestamp) AS coh_week,
     user_id AS id
 from sups as S 
order by coh_week, id
) as coh_nos

join 

(select ordmade.id, ordmade.weeks_diff as ordmade_items
from
    (select 
        user_id as id,    
        FLOOR(DATEDIFF(ord_timestamp, 
        coh_nos.coh_week)/7 ) as weeks_diff
    from ords as O 
    ) as in_ordmade
group by id, weeks_diff
) as ordmade 
on coh_nos.id = ordmade.id;

获取此错误:

ERROR 1146 (42S02) at line 29: Table 'test.coh_nos' doesn't exist

第一个select查询子句运行np,但添加第二个子句将抛出错误。

select * from coh_nos;

也扔同样的东西 does not exist 错误。
有什么好心人会同情我,告诉我为什么吗?
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题