1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Update records by matching with eachother within one table

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 10, 2024 às 07:43.

  1. Stack

    Stack Membro Participativo

    I have the following table structure:

    [​IMG]

    I want to match the records on the basis of transaction_ref and then update the ids of entry type records in invoice type records in column je_id

    The result should look like this.

    [​IMG]

    I tried the following but its not working:

    UPDATE sales SET je_id = id
    WHERE type = 'invoice' AND transaction_ref = transaction_ref;

    Continue reading...

Compartilhe esta Página