I have a MySQL varchar field with values like these:
'00007_1'
'00016_1'
'00016_2'
'00231_1'
'00326_3'
I'm looking for the best way to put this field in join with another table with a varchar field with values like these (I list those that match previous):
'7'
'16'
'16'
'231'
'326'
This is how I've made:
SELECT *
FROM R
INNER JOIN RC ON Trim(leading '0' from Substring(R.N_DEN,1,instr(R.N_DEN,'_')-1)) = RC.N_DEN
Anybody knows if there is a quicker and better performace solution?
Create a derived column with values pre-derived in the joining table. However there will be a space trade-off.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments