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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:39:04+00:00 2026-06-10T20:39:04+00:00

Given my table id | name 01| Test Name 02| Name Test 03| Another

  • 0

Given my table

id | name
 01| Test Name
 02| Name Test
 03| Another name
 ...
 ...
 nn| Test string

I’d like to do the following, for each entry, read the first word, until a space, so in this example i would read Test, then, find all similar entries which contain Test anywhere on the string, then continue with Name, Another, and so on.

I don’t want to do this manually, as I’ll have to make a lot of queries, the idea is the data is imported from an old excel spreadsheet and the client wants to get repeated names, so Test Name, Test Something Name and Name Test are potential similar names.

  • 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-10T20:39:06+00:00Added an answer on June 10, 2026 at 8:39 pm

    Here’s my db solution:

    SELECT * 
    FROM princess a
    INNER JOIN (SELECT 
            DISTINCT CASE
                WHEN name LIKE '% %' 
                    THEN SUBSTR(name, 1, LOCATE(' ', name) - 1)
                ELSE name
            END AS 'name'
        FROM princess) b ON a.name LIKE CONCAT('%', b.name ,'%')
    

    This will find the DISTINCT names (before a space) and then JOIN to the original table using LIKE.

    You may also consider using INSTR(a.name, b.name) in place of b.name LIKE CONCAT('%', a.name ,'%') depending on how your EXPLAIN looks.

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

Sidebar

Related Questions

Given the following table on sheet one: Name ------- Alan Barb Corey Barb Alan
Lets say I have an Areas Table ( id, parentId, name, path ). Given
Let's say I have SELECT name FROM table which gives me something like foo
Given the following Tables: Names Id int Name varchar Properties Id int NameId varchar
Given: CREATE TABLE foo (id BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)); I'd like to
Given date range in Table for particular record say for particular feild Name If
I am using one database like Test(db name) in this database i added 10
In MS-SQL we can have the following constraint during table creation create table test
I have a table name that starts with an underscore does that give any
Given two tables APPLE and ORANGE, NAME APPLES Alice 5 Bob 10 Trudy 1

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.