gpt4 book ai didi

子查询抛出错误 : "Wrong table name or table alias"

转载 作者:行者123 更新时间:2023-12-02 06:29:26 28 4
gpt4 key购买 nike

在 SAP 中,以下请求运行良好,但结果是我获得了 3000 种 Material 的 #5000000 行 (MATNR):

SELECT  k~bldat a~matnr k~bldat e~maktx a~mtart a~brgew
a~ntgew a~gewei a~volum a~laeda mseg~bwart k~budat
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mseg
INNER JOIN makt AS e ON e~matnr = mseg~matnr
INNER JOIN mara AS a ON a~matnr = mseg~matnr
INNER JOIN mkpf AS k ON k~mblnr = mseg~mblnr
WHERE a~mtart in ('ZRSV','ZVTP').

但是,如果我只想要每个 MATNR 的最后一次运动/日期,以下请求将返回此错误: 错误的表名或表别名表别名“(SELECT MAX(T”。

SELECT k~bldat a~matnr k~bldat e~maktx a~mtart a~brgew
a~ntgew a~gewei a~volum a~laeda mseg~bwart k~budat
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mseg
INNER JOIN makt AS e ON e~matnr = mseg~matnr
INNER JOIN mara AS a ON a~matnr = mseg~matnr
INNER JOIN mkpf AS k ON k~mblnr = mseg~mblnr
WHERE a~mtart in ('ZRSV','ZVTP')
AND k~bldat = (SELECT MAX( t~bldat ) FROM mkpf AS t
WHERE t~mblnr = mesg~mblnr).

知道语法问题吗?提前致谢。

最佳答案

您需要在子SELECT语句前添加空格:

AND k~bldat = ( SELECT MAX ... = ~mblnr ).
^ HERE AND HERE ^

关于子查询抛出错误 : "Wrong table name or table alias",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16807693/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com