配置单元错误,在减法查询中获取eof错误

5uzkadbs  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(368)

我在港湾附近的“-”得到一个丢失的eof,大部分查询看起来是正确的。只是不知道如何在Hive中实现减号。

SELECT
    a.playerID AS ID,
    a.yearID AS yearID,
    (b.HAB - a.EG) AS HAB-EG
FROM 
    (SELECT
        playerID,
        yearID,
        (E/G) AS EG
    FROM fielding
    WHERE (
            yearID > 2005
            AND yearID < 2009
            AND G > 20 
            )
    ) AS a
JOIN
    (SELECT
        id,
        year,
        (hits/ab) AS HAB
    FROM batting
    WHERE( 
            year > 2005
            AND year < 2009 
            AND ab > 40 
            )
    ) AS b ON a.playerID = b.id AND a.yearID = b.year;
aiqt4smr

aiqt4smr1#

别名应该用引号引起来 backtick character (``) 字符,包括任何附加字符(如空格或破折号)。
因此,请使用以下命令:

SELECT
    a.playerID AS ID,
    a.yearID AS yearID,
    (b.HAB - a.EG) AS `HAB-EG`

相关问题