0
I would like to take the average sales of the month by product description and not by date with day, month and year, but I don’t know how to get.
SELECT AVG(vend_qtde) AS qtde_vendas from tb_vendas WHERE esto_descricao like '% Saco pedra %' and vend_data like '% 03/01/2018 %' GROUP BY esto_descricao;
Script from my database:
CREATE TABLE tb_vendas
(
vend_cod serial NOT NULL,
esto_descricao character(30) NOT NULL,
vend_preco double precision,
vend_qtde integer,
vend_nome_cliente character(35),
vend_cep character(20),
vend_bairro character(25),
vend_endereco character(38),
vend_estado character(20),
vend_uf character(13),
vend_data character(20),
vend_hora character(20),
CONSTRAINT tb_vendas_pkey PRIMARY KEY (esto_descricao, vend_cod)
)
Records: