sql >> Base de Datos >  >> RDS >> Mysql

Función MySQL Agregar precios de varias tablas

Prueba esto,

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
);