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

[SQL] Join two sql queries with return one response

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

  1. Stack

    Stack Membro Participativo

    How to summarize these two commands in one command ?

    SELECT userName,userId, SUM(amount) AS total_debit
    FROM debts
    where buyerId != userId
    GROUP BY userName
    ORDER BY userId


    SELECT buyer,userId, SUM(amount) AS total_credit
    FROM debts
    where buyerId != userId
    GROUP BY buyer
    ORDER BY userId

    Continue reading...

Compartilhe esta Página