SQL:第 5:5 行:第 'c' 列不明确

SQL: line 5:5: Column 'c' is ambiguous

我在hiveql中写了这样的代码。

SELECT
    ttt1.rid,
    a,
    s,
    ttt2.num
FROM
    (
        (
            SELECT
                rid,
                r ['a'] AS a,
                r ['s'] AS s
            FROM
                l
            WHERE
                dt BETWEEN '20210914'
                AND '20210917'
                AND r ['act'] = 3
                AND r ['pos'] = 1
                AND r ['s'] = 50011
                AND r ['c'] = 'anti'
        ) ttt1
        JOIN (
            SELECT
                r ['a'] AS a,
                r ['s'] AS s,
                count(1) AS num
            FROM
                l
            WHERE
                dt BETWEEN '20210914'
                AND '20210917'
                AND r ['act'] = 3
                AND r ['pos'] = 1
                AND r ['s'] = 50011
                AND r ['c'] = 'anti'
            GROUP BY
                r ['s'],
                r ['a']
        ) ttt2 ON (
            ttt1.a = ttt2.a
            AND ttt1.s = ttt2.s
        )
    )

我想知道为什么会出现模棱两可的错误。

line 5:5: Column 'c' is ambiguous

CUZ as是这两个表的join键,可以忽略<COLUMN_NAME>前的<TABLE_NAME>.
谁能给我解释一下?
提前致谢。

我认为问题出在最后 select,您没有指定 a 和 s 是从哪个表中select编辑的

SELECT
    ttt1.rid,
    a, --change this to ttt1.a
    s, --change this to ttt1.s 
    ttt2.num