Is there a way to do a like join on two columns based on only the first 3 characters of one of the columns?

  Kiến thức lập trình

Table1
| Column A | Column B |
| ——– | ——– |
| 0001 | AMP^ |
| 0002 | JUN^ |
| 003 | RES^ |

Table2

Column A Column B
AMY JONES AMPLITUDE
JUNE SMITH JUNEBUG
HARRY LOO HAR^

I want to join these two tables on Column B in both tables but when I do a like nothing comes back and I think it is because of the ^ character and I’m not sure how to get around this.

Select Table1.,
Table2.

FROM Table1
left join Table2
on Table1.column_B like CONCAT(Table2.column_B, ‘%’)

This is what I want to get back:

Column A Column B
AMY JONES AMPLITUDE
JUNE SMITH JUNEBUG

–I do apoligize if this is sloppy but I am a new student to SQL so am not entirely versed on the ins and outs yet. Thank you in advance for your help–

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT