Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:43:15+00:00 2026-05-17T01:43:15+00:00

I have a table table_a with a column containing data as follows: .aaa01932 .asd02343

  • 0

I have a table table_a with a column containing data as follows:

.aaa01932
.asd02343
.lkj03342

So it always starts with a period followed by 3 letters, followed by 2 number (01, 02 etc) followed by some extra numbers.

I have another table table_b with data as follows:

aaa01
asd02
lkj03

So it maps to the data in table_a but with the period and the extra numbers at the end omitted.

How do I select from table_a joining on table_b where the data in the shown columns are “equal”. By equal I mean that table_a.the_column like ‘%table_b.the_column%’. So something like:

Select * from table_a 
  join table_b on (table_a.the_column like '%table_b.the_column%');

Except I don’t know how to format that like clause to accept a column inside. Maybe I need to concatenate it in somehow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:43:16+00:00Added an answer on May 17, 2026 at 1:43 am

    The syntax for the LIKE would be:

    table_a.the_column like '%' || table_b.the_column || '%'
    

    An alternative would be SUBSTR:

    table_b.the_column = substr(table_a.the_column,2,5)
    

    As some comments have said, the SUBSTR is a better method for 2 reasons:

    • It can be indexed:

      create index on table_a (substr(the_column,2,5));

    • It is more accurate: you want to match only in that position, not anywhere in the column

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a db table containing a column display_order . The data looks like
In SQL server 2008 R2, I have a table with column containing nvarchar(max) data.
I have a SQL Server 2000 with a table containing an image column. How
Assuming I have a SQL Server 2005 table with an xml column containing the
I have a text file containing data/fields which are separated by exact column no.
I have a large table (6m records) containing data licensed from a vendor. The
I have a MySQL table containing a column to store time and another to
First, I have created a table called Placemarks containing a column of type 'geography'.
I have a two column table containing CustomerName and Age columns. I have all
Suppose (to simplify) I have a table containing some control vs. treatment data: Which,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.