2

我已经为我的 netezza db 构建了流动的 SQL:

select t.TRADE_OID, t.TRADE_ID, t.TRADE_VERSION, t.TRADE_SOURCE_SYSTEM, tl.LINK_PARENT_ID, 
tl.LINK_PARENT_VERSION, tc.CHARGE_AMOUNT FROM EQ_MO_TRADE (NOLOCK) t, EQ_MO_TRADE_CHARGE (NOLOCK) tc, EQ_MO_TRADE_LINKAGE (NOLOCK) tl 
WHERE t.Last_update_time >= '2013-01-09 00:00:00' 
AND t.last_update_time < '2013-01-10 00:00:00' 
AND t.TRADE_OID = tl.TRADE_OID
AND t.TRADE_OID = tc.TRADE_OID
AND tc.CHARGE_NAME = 'Commission'

但是我得到了一般错误:

 [SELECT - 0 row(s), 0.000 secs]  [Error Code: 1100, SQL State: HY000]  ERROR:  'select 

t.TRADE_OID, t.TRADE_ID, t.TRADE_VERSION, t.TRADE_SOURCE_SYSTEM, tl.LINK_PARENT_ID, tl.LINK_PARENT_VERSION, tc.CHARGE_AMOUNT FROM EQ_MO_TRADE (NOLOCK) t, EQ_MO_TRADE_CHARGE (NOLOCK) tc, EQ_MO_TRADE_LINKAGE (NOLOCK) tl 
WHERE t.Last_update_time >= '2013-01-09 00:00:00' 
AND t.last_update_time < '2013-01-10 00:00:00' 
AND t.TRADE_OID = tl.TRADE_OID
AND t.TRADE_OID = tc.TRADE_OID
AND tc.CHARGE_NAME = 'Commission' limit 1000'
error                                                                                                                                                         

^ found "(" (at char 150) expecting `EXCEPT' or `FOR' or `INTERSECT' or `ORDER

字符 150 介于这两者之间:

贸易和(NOLOCK)

我的语法似乎正确,但 DBVisualiser 不会运行查询。

4

1 回答 1

1

据我从Netezza 数据库用户指南 (5.0.x)中得知,Netezza 不支持优化器提示,例如WITH (NOLOCK).

从第 3.36 页开始

请注意,不需要用户干预、命令或提示

无论如何,NOLOCK被广泛认为是可疑的做法

但是,Netezza 确实支持INNER JOIN语法 (p2.17)

我将按如下方式重写查询:

SELECT
    t.TRADE_OID, 
    t.TRADE_ID, 
    t.TRADE_VERSION, 
    t.TRADE_SOURCE_SYSTEM, 
    tl.LINK_PARENT_ID, 
    tl.LINK_PARENT_VERSION, 
    tc.CHARGE_AMOUNT 
FROM 
  EQ_MO_TRADE t 
    INNER JOIN EQ_MO_TRADE_CHARGE tc
            ON (t.TRADE_OID = tc.TRADE_OID)
    INNER JOIN EQ_MO_TRADE_LINKAGE tl 
        ON (t.TRADE_OID = tl.TRADE_OID)
WHERE 
  t.Last_update_time >= '2013-01-09 00:00:00' 
  AND t.last_update_time < '2013-01-10 00:00:00' 
  AND tc.CHARGE_NAME = 'Commission'
于 2013-01-17T11:57:21.333 回答