I have a table with the field CtrlChargeNum that has the log of the number of the load of a truck. I need to make a query that brings the total of that field. Until I got the query, see:
SELECT COUNT (*) CtrlCargaNum
FROM CTRL_CARGA
WHERE CtrlCargaData BETWEEN '2018-01-01' AND '2018-01-04' AND EmpCod = '01.01'
But it only counts the records that are on these dates.
I would like it to take the number of the load that is repeated and count as 1 LOAD
Ex:
CtrlCargaNum = 1001
CtrlCargaNum = 1001
= 1 CARGA
CtrlCargaNum = 1002
CtrlCargaNum = 1002
CtrlCargaNum = 1002
= 1 CARGA
and add these loads: 1 LOAD + 1 LOAD = 2. I am using mysql server