首页 > 解决方案 > mysql“where子句中的未知列”

问题描述

我试图编写一个程序,但是当我尝试运行它时,我得到了这个错误:

错误代码:1054。“where 子句”中的未知列“lista1.ID”

这是例程代码:

CREATE DEFINER=`root`@`%.zamberlan.local` PROCEDURE `TMTotal`()
BEGIN
    DROP temporary table if exists `lista1`;
    CREATE temporary TABLE `lista1` as
    (select 
        T.idarticolo as ID,
        avg(tempo) as TI
    from
        (select 
            idarticolo,
            ordineua,
            tempo
        From ordini 
        where tempo Is Not Null 
        group by ordineua 
        having count(ordineua) = 1) T
        group by T.idarticolo);
UPDATE
    articoli
set
    tempomediogg=lista1.TI 
where articoli.id=lista1.ID;
END

为什么?

标签: mysql

解决方案


推荐阅读