Reputation: 3209
I have this script here
select distinct
FirstName,
LastName,
table_2.status,
'Shop' as receiver
from table_1
inner join table_2 on table_1.key_2 = table_2.'SHOP-'id
order by FirstName, LastName
the key_2 field has ids like SHOP-121 and the id in table 2 would just be the number 121.
How would I remove the SHOP- from key_2 or add SHOP- to id?
Upvotes: 0
Views: 67
Reputation: 263693
use CONCAT
table_1.key_2 = CONCAT('SHOP-', table_2.id)
Remember that this will perform full table scan causing it to be slow on large database.
Upvotes: 5