Sql query


I have been using SAS for years with both Oracle and SQL Server databases.  I am now on a platform that just used SQL DBF.  Some of the things I could do in SAS, cannot do some I am feeling my way around,

I have a field that is 7 characters.  However if all 7 characters do not match, I can match on the first five.  The primary match is all 7 .  The secondary match is just the first five.

Can someone tell me the best approach to achieve this is SQL.
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?

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

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.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
.DBF => which version / drivers are you using?
also, can you show some examples of input data and expected output you have, to show the different scenarios...

to match on the first 5, you would use a sub string function (which will however kill sql performance...)
could there be both/several/different matches on first 5 and on 7 characters?

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
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.