Hello I have a database and I want to group some data, the database is structured as follows
Lote | Surtio | Lugar | Fecha
All are string type, and I have the following query
SELECT surtio , lote FROM filtrado
where linea = 'pilas' and fecha like '28/abr/18%'
with this I get the data but I leave without being grouped, the name of the person but the lot number but for example if the lot has 5 things that person leaves 5 times with the same no. of batch and then what I want is that people are grouped with the batch number, try a group by but can not by the simple fact that a person can have 2 or more batch numbers, and here is where I am stuck, if you could help me solve this what I'm looking for is to have the following result
Surtido | Cantidad Lotes
Pedro 5
Juan 2
Let them tell me the number of different lots they have assigned and also be able to have the following
Surtido | Lote
Pedro 55504
Pedro 55201
Pedro 66666
Pedro 45646
Pedro 34213
Help how to achieve them, even though I try to do it, I can not think of how, in advance, thanks.