if you want to update the field with the trimmed string :
UPDATE table_name SET email_col = SUBSTRING_INDEX(email_col,
// -2 can be any negative value, I used -2 because thats the way I studied. :-D It will return "hp.com"
// If you specify a positive value instead of -2 , it will return "jsmith"
Main Topics
Browse All Topics





by: ldbkuttyPosted on 2005-01-25 at 19:24:43ID: 13138834
SELECT SUBSTRING_INDEX(email_col, '@', -2);