4
I have to update the field custo table pedidos based on the field valor table produtos_pedidos.
Whereas the a.id table pedidos must be equal to the field b.id_pedido table produtos_pedidos.
I’m trying to do it like this:
UPDATE 
pedidos a
SET 
custo = (
    SELECT 
        b.valor
    FROM 
        produtos_pedidos b
    WHERE 
        b.id_pedido = a.id
    )
I’m making that mistake:
Coluna 'custo' não pode ser vazia
This is the whole update? can be the select returned some record with null in the value column.
– rray
That’s probably what’s going on.
– Hugo Borges