mirror of
https://github.com/IdalecioSch/dbTrabai.git
synced 2026-07-28 00:30:28 -03:00
menos ilegivel
This commit is contained in:
committed by
GitHub
parent
7dc8b8b862
commit
bbc4a50760
+7
-8
@@ -20,15 +20,14 @@ BEGIN
|
|||||||
|
|
||||||
UPDATE encomenda
|
UPDATE encomenda
|
||||||
SET valor = (
|
SET valor = (
|
||||||
SELECT COALESCE(
|
SELECT COALESCE(
|
||||||
SUM(m.custo + LENGTH(i.frase) * m.valor_letra),
|
SUM(m.custo + LENGTH(i.frase) * m.valor_letra), 0.00
|
||||||
0.00
|
)
|
||||||
)
|
|
||||||
-- Coalese pq ele tenta pegar sum, se ficar null, retorna 0.00 msm, como um operador ternario
|
-- Coalese pq ele tenta pegar sum, se ficar null, retorna 0.00 msm, como um operador ternario
|
||||||
FROM item i
|
FROM item i
|
||||||
JOIN placa p ON p.id = i.placa_id
|
JOIN placa p ON p.id = i.placa_id
|
||||||
JOIN material m ON m.id = p.material_id
|
JOIN material m ON m.id = p.material_id
|
||||||
WHERE i.encomenda_id = val_enc_id
|
WHERE i.encomenda_id = val_enc_id
|
||||||
)
|
)
|
||||||
WHERE id = val_enc_id;
|
WHERE id = val_enc_id;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user