There are two tables:
TABLE bills
item_id | price
c1 | 10000
m1 | 9000
m2 | 8000
TABLE cars
id | model
1 | toyota
2 | bmw
I need JOIN both tables, where item_id=id AND the first letter in item_id is ‘c’, so I need to get: c1 | 10000 | 1 | toyota
Note that performance is orders of magnitude better (and acceptable) joining in this order, because the calculation to generate the composite key is done once per car, rather than once per car/bill combination had I joined bills first then cars.