A column dialed_number of tableA
columns city_code and operator_name of tableB

Examples of the two columns are


dialed_number city_code operator_name
355425298132588 355425 Vodafone
9377711080682 937 GP

Now I have to find the operator_name matching the dialed_number i.e. for each dialed_number I have to find the operator name. City code is not a fixed length code.

I have tried it:

SELECT tableA.dialed_number,tableB.city_code
FROM tableA
LEFT OUTER JOIN tableB ON tableA.dialed_number LIKE CONCAT(tableB.city_code,'%')ct

but, I think it is not perfect..