在相关嵌套查询中只有WHERE子句或外部查询中只有WHERE子句,性能是好还是坏?ex:下面的嵌套查询定义price_key,但外部查询引用了price_key也在外部查询WHERE语句
中定义INNER JOIN (
SELECT inv.item_key, s.price_key, MAX(inv.last_receive_cost / inv.last_receive_units_case) AS [unit_cost]
FROM inventory inv
INNER JOIN stores s on inv.location_key = s.store_key
WHERE inv.on_hand_inventory_qty > 0
AND inv.last_receive_cost > 0
AND inv.last_receive_units_case > 0
AND s.price_key = (29)
GROUP BY inv.item_key, s.price_key
) t ON r.item_key = t.item_key and r.price_key = t.price_key
答案 0 :(得分:0)
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude> 2^74207281 - 1