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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:33:45+00:00 2026-06-18T12:33:45+00:00

Table A id name 1 name1 2 name2 3 name3 4 name4 Table B

  • 0

Table A

id    name
1     name1
2     name2
3     name3
4     name4

Table B

id    userlist
1     1,2,3,4

What I do now is

SELECT `userlist` FROM `table B` WHERE `id` = 1

Then save the result and put into second query

SELECT `name` FROM `table A` WHERE `id` in ($userlist)

Just wondering if got better way. I try

SELECT `name` FROM `table A` WHERE `id` in (SELECT `userlist` FROM `table B` WHERE `table B`.`id` = 1)

But it only return 1 result.

EDIT*

DB structure can not be change since so many data inside. I just try to optimize the old code.

  • 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-18T12:33:46+00:00Added an answer on June 18, 2026 at 12:33 pm

    You could use FIND_IN_SET:

    SELECT `name`
    FROM `table A` INNER JOIN `table B` ON
         FIND_IN_SET(`table A`.`id`, `table B`.`userlist`)
    WHERE `table B`.`id` = 1
    

    but i would suggest you to normalize your tables.

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

Sidebar

Related Questions

My Database Table Schema is something like DocumentID: Name1: Name2: Name3: Name4: Location1: Location2:
I have the following table structures. Table A id name 1 name1 2 name2
I have a html table: Name Length Description x Name1 444 Blabd x.png Name2
Mysql: Table_A ------------ id name 1 Name1 2 Name2 Table_B ------------ a_id type value
I'm using Simple.Data to select data from a table and am wondering if there
How can I transform this table from this id name 1 sam 2 nick
<c:if test=${not empty userList)}> <table cellpadding=5> <tr class=even> <th>Name</th> <th>Gender</th> <th>Country</th> <th>About You</th> </tr>
I've seen people writing the following query SELECT column_name(s) FROM table_name1 LEFT JOIN table_name2
I have the following table drop table names; create table names( name varchar(200), surname
Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:

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.