This sounds a little bit confusing and I don't know how to put it in words, but I'm having a hard time finding a solution of this problem.
I want to 'group by' the rows and count them in the table using the 'digit' column that has the same digits regardless of the digit's position.
example:
this is the table
| Id | Name | Digit |
|---|---|---|
| 1 | name1 | 123 |
| 2 | name2 | 213 |
| 3 | name3 | 132 |
| 4 | name4 | 122 |
| 5 | name5 | 456 |
the answer would be: with count()
| Name | Digit | Count |
|---|---|---|
| name1 | 123 | 3 |
| name4 | 122 | 1 |
| name5 | 456 | 1 |
additional details:
- the digit column is numeric
- length fixed(3)
- the 'name' column display must be any from the group (could be name1, name2, or name3)
mysql version is 82 from cpanel.
SELECT VERSION();and provide complete output. - AkinaDigitvalue at the time when you write out each record. Do this from your application layer, where it is much easier to handle. Swinging this from MySQL is going to be fairly ugly (and non performant). - Tim Biegeleisen0is present in the values? Does it may be (formally) leading? - Akina