INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Query part of a field for data found in another table

Query part of a field for data found in another table

(OP)
I want to query a table to find all the records where there is a match between a string of characters in one column and a field in another table. The issue is that there is other data to the left and right of the relevant string in the first table, so I need to figure out a way to match only part of the field. See below for clarification

Table1
Johnny_Edwards_1234------Data1
Mike_Clinton_1234-----------Data2
Billy_Bobby_123--------------Data3
John_Wayne_590812--------Data4
Ryan_Clarke_0823-----------Data5


Table2
Edwards------ASDF1
Bobby---------ASDF2
Clarke---------ASDF3

I want the Query to return to following:
Edwards----Data1
Bobby-------Data3
Clarke-------Data5

RE: Query part of a field for data found in another table

select table2.field1,tabel1.field2
from table1,table2
where instr(table1.field1,table2.field1)>0

try this, should give you the basics

Technological progress is like an axe in the hands of a pathological criminal

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close