Frog82
Frog82

Reputation: 464

Remove Last Character if its a number

Basically, I have a database with over 1 million records, where duplicated values are deemed as duplicates and have a number at the end of the record.

Is there an SQL statement that selects value if the last character is a number?

select RIGHT('abcdeffff',1)

I need a mySQL version, that gets the last character as so but with if statement checking if it's an integer?

Upvotes: 0

Views: 60

Answers (1)

Scott Dobbins
Scott Dobbins

Reputation: 294

Try using REGEXP.

 Where RIGHT('abcdeffff',1) REGEXP ('[0-9]') 

Upvotes: 2

Related Questions