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 NEWUSER3@domain.com
since 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 ?