0

hi i have the following table (battles) :

+-----------+------------------------------------------+
| id        | battles                                  |
+-----------+------------------------------------------+
| 1         | 1;2                                      |
| 2         | 231;2                                    |
| 3         | 3330;0                                   |
| 4         | 11;333                                   |
| 5         | 32;3324                                  |
| 7         | 2;1                                      |
| 8         | 333:233                                  |
+-----------+------------------------------------------+

The table contains the win and loss of each player (win;lose)

how can i select the biggest win (3330;0)

HoldOffHunger
  • 15,349
  • 8
  • 79
  • 115
alex555
  • 15
  • 6

1 Answers1

0

Your last entry must be

| 7 | 333;233

to work properly. i believe it is only a typo

SELECT id,battles, maximal
From battles t inner join
(Select 
MAX(SUBSTRING_INDEX(battles,';',1)+0) maximal
FRom battles) t1 on t1.maximal = SUBSTRING_INDEX(t.battles,';',1);

The result is

d   battles     maximal
3   3330;0      3330

If you had more ids with 3300 then they would also appear in the result

Strawberry
  • 33,338
  • 13
  • 38
  • 57
nbk
  • 31,930
  • 6
  • 24
  • 40