配置单元用另一个表中的select更新表列

时间:2016-03-27 19:09:38

标签: mysql sql hadoop hive hql

全部, 这可能在蜂巢中,如果是这样,这是最优化的方式吗?谢谢!

    UPDATE t1
    SET
    Y = SQRT(Y_w)*(Y-(SELECT v FROM t2 WHERE ID=1)),
    X1 = SQRT(Y_w)*(X1-(SELECT v1 FROM t2 WHERE ID=1)),
    X2 = SQRT(Y_w)*(X2-(SELECT v2 FROM t2 WHERE ID=1)),
    X3 = SQRT(Y_w)*(X3-(SELECT v3 FROM t2 WHERE ID=1)),
    X4 = SQRT(Y_w)*(X4-(SELECT v4 FROM t2 WHERE ID=1)),
    X5 = SQRT(Y_w)*(X5-(SELECT v5 FROM t2 WHERE ID=1)),
    X6 = SQRT(Y_w)*(X6-(SELECT v6 FROM t2 WHERE ID=1)),
    X7 = SQRT(Y_w)*(X7-(SELECT v7 FROM t2 WHERE ID=1)),
    X8 = SQRT(Y_w)*(X8-(SELECT v8 FROM t2 WHERE ID=1));

1 个答案:

答案 0 :(得分:0)

请验证您的查询。 它只有在t1有w列且t2有id列时才有效。