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 847395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:46:34+00:00 2026-05-15T06:46:34+00:00

I have two tables, I want to search TermID in Table-A through TermID in

  • 0

I have two tables, I want to search TermID in Table-A through TermID in Table-B and If there is a termID like in Table-A and then want to get result table as shown below.
TermIDs are in different length. There is no search pattern to search with “like %”
TermIDs in Table-A are part of the TermIDs in Table-B
Regards,

Table-A

ID         TermID
101256666 126006230
101256586 126006231
101256810 126006233
101256841 126006238
101256818 126006239
101256734 1190226408
101256809 1190226409
101256585 1200096999
101256724 1200096997
101256748 1200097005

Table-B

TermNo TermID
14 8990010901190226366F
16 8990010901190226374F
15 8990010901190226382F
18 8990010901190226408F
19 8990010901190226416F
11 8990010901200096981F
10 8990010901200096999F
12 8990010901200097005F
13 8990010901200097013F
17 8990010901260062337F

As a result I want to get this table;
Result Table -TableA.ID TableA.TermID TableB.TermNo

A.ID      A.TermID  B.TermNo
101256734 1190226408 18
101256585 1200096999 10
101256748 1200097005 12
  • 1 1 Answer
  • 1 View
  • 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-15T06:46:35+00:00Added an answer on May 15, 2026 at 6:46 am

    Your expected resultset is wrong: TABLE_A.TERMID = 126006233 matches TABLE_B.TERMID = 8990010901260062337F.

    Anyway here is a solution:

    SQL> select a.id, a.termid, b.termno
      2  from table_a a cross join table_b b
      3  where instr(b.termid, a.termid) != 0
      4  order by b.termno
      5  /
    
            ID TERMID                   TERMNO
    ---------- -------------------- ----------
     101256585 1200096999                   10
     101256748 1200097005                   12
     101256810 126006233                    17
     101256734 1190226408                   18
    
    SQL>
    

    edit

    I suppose I had better point out that INSTR() is an Oracle function. MySQL also has it. But if by [sql] you meant “SQL Server” then you should substite the CHARINDEX() function.

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

Sidebar

Related Questions

I have two tables, Person and Role. I want to search the Person table,
I have two tables Loan(Parent Table) and Receipt(Child table)what i want to do is
I have two tables and two buttons. I want table-1 to be in the
I have two tables like the following hotels ------ hotelID hotelName Second table operators
I have two tables like this: Table Name: users emx | userid --------------- 1
I have a scenario like this: There are two tables table1 and table2 .
I have two tables that I want to join together. Table1 Year, ID, Theme,
I have two tables which I want to join together using a left outer
I have two tables and I want to display only the child ID that
I have two mysql tables and i want to merge the results of these

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.