1
i have a table that has an ID field.
ID
1234
1234
1235
1235
1235
1236
And I would like to get via query the following result:
ID ID_Counter
1234 2
1234 2
1235 3
1235 3
1235 3
1236 1
Where in the second column the field value would be the amount of times the ID of that row appears in the ID column.
I tried the query: select ID, Count(ID) from tabela group by ID
, but the result is:
ID ID_Counter
1234 2
1235 3
1236 1
It would be like a cont.se()
Microsoft Excel, but I’m not sure how to create the query in Mysql Workbench.
But what is the logic of it? The result you get is the correct one!
– Diego Souza
The query is right... what exactly is missing?
– Marllon Nasser
Is that each line of this bank is an interaction of a consultant with the client, so not to lose accurate information that all lines appear and also need a counter for possible filters in reports.
– Lucas Bicalho