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

  • Home
  • SEARCH
  • 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 9151615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:50:47+00:00 2026-06-17T11:50:47+00:00

I have two table in two different database. Kalix2 –>I have one table ph_Companies

  • 0

I have two table in two different database.

  1. Kalix2 –>I have one table ph_Companies
  2. Asterisk–> Here I have table called cdr.

In ph_Companies I am having CompanyName column and company name is in this format.

   CompanyName
  AccuWebHosting

In other table I am having another column clid which stores the company name in the following format.

    clid
   "AccuWebHosting-EN" <6618083563> 

Now, my question is how can I make join between these two table based on this column. In both the table these are the only column which is having some common data. No other column is having similar data.

Please help me. Thanks in advance.

  • 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-06-17T11:50:48+00:00Added an answer on June 17, 2026 at 11:50 am
    SELECT  a.*, b.*
    FROM    ph_Companies a
            INNER JOIN otherTable b
                ON b.clid LIKE CONCAT('%', a.CompanyName, '%')
    

    Caution, this query is very slow if you want large database because it requires a FullTable Scan. The reason is you have “bad” schema design. I’ll recommend you to alter the tables like this,

    CREATE TABLE ph_Companies
    (
        ID INT PRIMARY KEY,
        CompanyName VARCHAR(20),
        -- OTHER COLUMNS HERE
    );
    
    CREATE TABLE otherTable 
    (
        ID INT AUTO_INCREMENT PRIMARY KEY,
        CompanyID INT,
        CompanyName VARCHAR(20),
        clid VARCHAR(50),
        -- OTHER COLUMNS HERE
        CONSTRAINT tb_fk FOREIGN KEY (CompanyID)
            REFERENCES ph_Companies (ID)
    );
    

    and you will have a query like this,

    SELECT  a.*, b.*
    FROM    ph_Companies a
            INNER JOIN otherTable b
                ON a.ID = b.CompanyID
    

    which is FAR more better than the query above.

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

Sidebar

Related Questions

i have two tables one is called addons and holds information about different addons,
I have two tables with different database: AccntID from table 'account' <--database name 'ECPNWEB'
I have two tables from two different databases. For example: Table: Articles1 - Database:
I have two different views to the same database table and I would like
I have two databases at two different places, both databases are same with table
I've got a table recording views of programs. Each program can have two different
I have a page that displays a table in two different modes. In each
I have an HTML document where I have two different tables. One is class
Hi I have two database servers (2 different machine, but on same network). I
I'm structuring a database, and found that I have two different objects I'm trying

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.