Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Função MySQL Adicionar preços de várias tabelas


Tente isso,
SET price = 
(
    SELECT  SUM(x.Price) 
    FROM
    (
        SELECT priceFactor AS Price FROM tblCheese WHERE cheeseName = cheese
        UNION ALL 
        SELECT priceFactor AS Price FROM tblMeat WHERE meatName = meat 
        UNION ALL 
        SELECT priceFactor AS Price FROM tblVeggie WHERE veggieName = veg
    ) x
);