"列引用含糊不清或重复的名称"在Apache Phoenix上使用别名时

时间:2015-12-24 09:36:02

标签: sql hbase phoenix

将Apache Phoenix 4.6.0用于HBase 1.1.2。

我有一个像这样创建的简单表:

CREATE TABLE "events" (
"uuid" VARCHAR(64) PRIMARY KEY,
"event"."session" VARCHAR(64),
"event"."name" VARCHAR(32),
"event"."date" UNSIGNED_DATE,
"product"."name" VARCHAR(32),
"data"."*" VARCHAR(64)
) default_column_family='event', IMMUTABLE_ROWS=true

这些查询有效:

SELECT COUNT(*) FROM "events" AS search WHERE search."event"."name" = 'search'

SELECT COUNT(*) FROM 
(SELECT click."event"."session" 
FROM "events" AS click WHERE "event"."name" = 'click')

但这不是:

SELECT COUNT(*) FROM "events" AS search 
WHERE search."event"."name" = 'search' 
AND search."event"."session" NOT IN (SELECT click."event"."session" 
FROM "events" AS click 
WHERE click."event"."name" = 'click');
  

错误:错误502(42702):列引用不明确或重复   名。 columnName = name SQLState:42702 ErrorCode:502

为什么?

1 个答案:

答案 0 :(得分:0)

尝试count(1)对不起作用的人$variable = 'x'; $query = $this->db->query(" SELECT... FROM... WHERE some_column = '$variable' "); return $query->result_array(); 。你清楚地对表格进行别名处理,但是背景中可能会有一些没有使用别名的星号。