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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:37:19+00:00 2026-05-23T11:37:19+00:00

I have two tables: Clients: id, name Texts: id, text Field text in Texts

  • 0

I have two tables:

Clients: id, name
Texts: id, text

Field text in Texts table can contain names of clients. I would like to find for each text, clients whose names are contained in text field. For example:

CLIENTS
id | name
1  | John Smith
2  | Mark Jackson
3  | Ann Boo

TEXTS
id | text
1  | John Smith and Ann Boo are my best friends.
2  | I really don't like Mark Jackson and John Smith.

The result should be:

RESULT
Text.id | Client.id | Client.name
1       | 1         | John Smith
1       | 3         | Ann Boo
2       | 1         | John Smith
2       | 2         | Mark Jackson

I hope you will help me 🙂
I want to know what parameters should find() function have or just mysql query

  • 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-23T11:37:19+00:00Added an answer on May 23, 2026 at 11:37 am
    DECLARE @clients TABLE (ID int IDENTITY(1,1), name VARCHAR(20))
    INSERT @clients (name)
    SELECT 'John Smith' UNION ALL SELECT 'Mark Jackson' UNION ALL SELECT 'Ann Boo'
    
    DECLARE @texts TABLE (ID int IDENTITY(1,1), [text] VARCHAR(200))
    
    INSERT @texts ([text]) VALUES ('John Smith and Ann Boo are my best friends.')
    INSERT @texts ([text]) VALUES ('I really don''t like Mark Jackson and John Smith.')
    
    SELECT T.id  [Text.id], C.id [Client.id], C.name [Client.name] 
    FROM @CLIENTS C 
    JOIN @TEXTS T 
    ON T.[text] LIKE '%' + C.NAME + '%'
    
    RESULT
    
    Text.id     Client.id   Client.name
    ----------- ----------- --------------------
    1           1           John Smith
    1           3           Ann Boo
    2           1           John Smith
    2           2           Mark Jackson
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have three tables that we would like to query to find out the
Let's say you have a database with two tables named clients and referrals. TABLE
I have two tables, first table structure (data) : -id -name -title -mail -source_id
I have a typical N-M relationship structure like this: two independent tables: Table Client:
I have two tables: services id client service and clients id name email How
I have two tables: Client(id,name,...) Purchase(id,item,date,client_id,...) They have their respective Model, with their validations.
I have those two tables: client: id (int) #PK name (varchar) client_category: id (int)
We have two Tables: Document: id, title, document_type_id, showon_id DocumentType: id, name Relationship: DocumentType
I have a table called meta , with two columns name and value .
I have two tables in the clients mssql database. The first is a job

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.