Naming SQL query tabs

Asked

Viewed 42 times

0

I have a tremendous doubt, I would like to name each query by its content, but I cannot identify how.

As a result I have the image below:

abas de nomes genéricos

My code is this one:

SELECT
    a.Marca,
    COUNT(a.Pedido) AS Quantidade,
    ROUND(SUM(a.Valor),2) AS Valor
FROM relat_chargeback_cs a
WHERE a.`Status` = 'BOLETO EXCECAO'
    GROUP BY a.Marca
    ORDER BY Quantidade DESC;
SELECT
    b.Marca,
    COUNT(b.Pedido) AS Boletos_Gerados
FROM relat_chargeback_cs b
LEFT JOIN boleto_emitido c
    ON b.Pedido = c.pedido
WHERE b.`Status` = 'BOLETO EXCECAO'
    GROUP BY b.Marca
    ORDER BY Boletos_Gerados DESC;
SELECT
    a.Marca,
    COUNT(b.pedido) AS Quantidade_Boletos,
    ROUND(SUM(b.valor_boleto),2) AS Boletos_Pagos
FROM relat_chargeback_cs a
LEFT JOIN boleto_emitido b
    ON a.Pedido = b.pedido
WHERE a.`Status` = 'BOLETO EXCECAO'
    AND b.pago = 'Sim'
GROUP BY a.Marca
ORDER BY Boletos_Pagos DESC;
SELECT
    a.Marca,
    COUNT(b.pedido) AS Quantidade_Boletos,
    ROUND(SUM(b.valor_boleto),2) AS Boletos_Pendentes
FROM relat_chargeback_cs a
LEFT JOIN boleto_emitido b
    ON a.Pedido = b.pedido
WHERE a.`Status` = 'BOLETO EXCECAO'
    AND b.pago = 'Não'
GROUP BY a.Marca
ORDER BY Boletos_Pendentes DESC;
SELECT
    a.Marca,
    LEFT(a.data_carregamento,7) AS Mes,
    COUNT(a.Pedido) AS Quantidade
FROM relat_chargeback_cs a
WHERE a.`Status` = 'BOLETO EXCECAO'
GROUP BY LEFT(a.data_carregamento,7), a.Marca
  • What is this tool used for visualization?

  • @Jeffersonquesado I’m like heidiSQL

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.