T-SQL JOIN

I was viewing a query offline (can't post the fully query here) that contained a JOIN but instead of
having the JOIN condition for the Primary Key =  Foreign key
the syntax was  Primary key LIKE Foreign key.    My question is I have never seen a T-SQL JOIN before like this.
If you have can you give me an example of when you would use LIKE instead of = in a JOIN.
Thanks for the help.
LVL 3
fjkaykr11Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
You would use a LIKE when the values were similar.  For example ZIP codes and 3 digit USPS postal codes.  As you may or may not know the USP postal rates for packages greater than 13 oz are determined based on the 3 digit ZIP codes, So your SQL query could look like this (assuming that the USPS had values for ZIPCode3 such as "760%":

FROM ShipAddress s
            USPSZones u on s.ZIPCode LIKE u.ZIPCode3

I am not saying this is a good approach or not, merely giving you an example.  So don't shoot the messenger.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fjkaykr11Author Commented:
Anthony thank you for the detailed explanation.  I really appreciate it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.