aflores
New Member
Hi. I have a sql statement which works as I need in phpMyAdmin but I have no idea how to code it in a calc element. I'm newbie in Fabrik, any suggestion is greatly appreciated.
-- Delete existing temporary table and create a new one from a query:
DROP TABLE IF EXISTS tmp1;
CREATE TABLE IF NOT EXISTS tmp1
SELECT concepto,SUM(importe) AS suma
FROM directo
GROUP BY directo.concepto;
-- Update data from the temporary table to an existing one:
UPDATE conceptos, tmp1
SET conceptos.insumos = tmp1.suma
WHERE conceptos.id = tmp1.concepto;
-- Delete existing temporary table and create a new one from a query:
DROP TABLE IF EXISTS tmp1;
CREATE TABLE IF NOT EXISTS tmp1
SELECT concepto,SUM(importe) AS suma
FROM directo
GROUP BY directo.concepto;
-- Update data from the temporary table to an existing one:
UPDATE conceptos, tmp1
SET conceptos.insumos = tmp1.suma
WHERE conceptos.id = tmp1.concepto;