Help with this query please, I do not know how to do it [closed]

-2

these are the data of my table

Tabla envios
ID proveedor, id componente, idarticulo, cantidad, fecha
    (1,'C1',100,100,'01/04/2013'),
    (2,'C2',200,200,'03/11/2013'),
    (3,'C3',300,300,'05/07/2013'),
    (4,'C4',400,400,'21/09/2013'),
    (5,'C5',500,5000,'11/10/2013'),
    (6,'C6',600,4560,'10/10/2013'),
    (7,'C7',700,100,'20/10/2013'),
    (8,'C8',800,200,'09/10/2013'),
    (9,'C9',900,300,'20/08/2013'),
    (1,'C10',1000,400,'30/04/2013'),
    (2,'C1',100,5000,'11/04/2013'),
    (3,'C2',200,4560,'31/12/2013'),
    (4,'C3',300,300,'28/12/2013'),
    (5,'C4',400,400,'02/11/2013'),
    (6,'C5',500,5000,'20/04/2013'),
    (7,'C6',600,4560,'19/04/2013'),
    (8,'C7',700,100,'04/03/2013'),
    (9,'C8',800,200,'01/01/2013'),
    (1,'C9',900,300,'05/02/2013'),
    (2,'C10',1000,400,'30/01/2013'),
    (3,'C1',100,5000,'18/03/2013'),
    (4,'C2',200,4560,'15/10/2013'),
    (5,'C3',300,100,'16/07/2013'),
    (6,'C4',400,200,'19/06/2013'),
    (7,'C5',500,300,'14/02/2013'),
    (8,'C6',600,400,'05/08/2013'),
    (9,'C7',700,5000,'30/12/2013')

And I have to make this query "How many shipments were made in December" if someone can help me please ...

    
asked by FRANCO ANEL UBALDE ARENAS 05.12.2018 в 15:38
source

2 answers

-1

The type DATE serves to efficiently store the date. The function MONTH() serves to return the month in an int

Change compodate to the column that is in the field

Edited:

SELECT COUNT(compodate) FROM envios WHERE MONTH(campodate) = 12
    
answered by 05.12.2018 / 15:47
source
0

Try the following query

SELECT COUNT(1) Total_Envios, SUM(Cantidad) Total_Cantidad FROM envios WHERE MONTH(fecha) = 12

I suppose that for your statistical data you will need both the total number of shipments, and the quantity of items sent.

    
answered by 05.12.2018 в 16:01