-drop table r.stray_cust;
CREATE VOLATILE TABLE r.stray_cust
(
CustomerID INTEGER
)
PRIMARY INDEX ( CustomerID );
INSERT INTO r.stray_cust
SELECT DISTINCT c.customerid AS customerid
FROM customer c
WHERE c.customerid
NOT IN (
SELECT a.customerid
FROM address a );
ON COMMIT PRESERVE ROWS;
select * from r.stray_cust;
继续收到错误消息 - 查询失败,请参阅历史记录日志了解详情
答案 0 :(得分:0)
那么,您是否查看了历史记录以获取详细信息?
ON COMMIT是CREATE VOLATILE TABLE的一部分,因此您的查询应为:
CREATE VOLATILE TABLE r.stray_cust ( CustomerID INTEGER ) PRIMARY INDEX ( CustomerID )
ON COMMIT PRESERVE ROWS;
INSERT INTO r.stray_cust
SELECT DISTINCT c.customerid AS customerid
FROM customer c
WHERE c.customerid NOT IN ( SELECT a.customerid FROM address a );
或者只需一步:
CREATE VOLATILE TABLE r.stray_cust AS
(
SELECT DISTINCT c.customerid AS customerid
FROM customer c
WHERE c.customerid NOT IN ( SELECT a.customerid FROM address a )
)
PRIMARY INDEX ( CustomerID )
ON COMMIT PRESERVE ROWS;
INSERT INTO r.stray_cust ;