Hi so I have email addresses saved for example in below format:
NEWUSER1@domain.com NEWUSER3@domain.com NEWUSER2@domain.com
As can be seen everything is same in these email except for the number before
@ sign. I want to select the last biggest email address with that number in this case
3 is biggest number in these emails.
I am not much aware about regex but I tried this:
SELECT id, email FROM tableName WHERE email regexp 'NEWUSER(\d+)@domain.com' ORDER BY email DESC LIMIT 1
But it didn't work obviously regex isn't correct :( Can anyone help on how to select row with biggest number email out of these please ?
preguntado el 13 de septiembre de 13 a las 12:09
SELECT * FROM tableName where email like 'NEWUSER%' ORDER BY CAST(SUBSTR(email FROM 8) AS UNSIGNED) desc limit 1