I want to create a left join between a concatenate result of two columns of the main table and another column of the second table. My question is, should this join affect the query performance? Is there any better way to do it?
Table A: Column1, Column2
Table B: Column3
Select *
from Table A left Outer Join
Table B on Column1+Column2=Column3
I appreciate your help.
Thanks
This is fine,
For SQL Server
Select *
from `Table A` as a left Outer Join
`Table B` as b on a.Column1 + a.Column2 = b.Column3
For MySQL use concat()
Select *
from `Table A` as a left Outer Join
`Table B` as b on concat(a.Column1,a.Column2) = b.Column3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.