With table:
idx | int | ident
1 | 10 | Foo 001_10
2 | 10 | Farfoo 002_11
3 | 11 | Sofoo 001_11
4 | 10 | Lafoo 001_10
5 | 10 | MoreFoo 001_11
How can I select all rows where the last 2 characters in the string ‘ident’ do not match the integer in the ‘int’ coloumn? Which for the table above would be:
2 | 10 | Farfoo 002_11
5 | 10 | MoreFoo 001_11
You can also use RIGHT string function using
right(ident,2)you will get the last two digits from string then compare it will int columnif both are unequal then retrieve the not matching contents.