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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:52:53+00:00 2026-06-09T12:52:53+00:00

I have two tables, one table has some information in each row along with

  • 0

I have two tables, one table has some information in each row along with a comma seperated list of ids that another table contains. Right now I am grabbing the data from table A (with the comma seperated ids), and I want to also grab all of the data from Table B (the table containing additional information). I would like to do this in the most efficient SQL method possible.

I was thinking about joining Table B to Table A based on the ids IN the field, but I was not sure if this is possible. It is also important to note that I am grabbing data from Table A based on another IN statement, so my ultimate goal is to attach all of the rows in Table B to Table A’s rows depending on which ids are in the field in Table A’s rows (row by row basis)

If someone could follow all of that and knows what I am trying to do I would appreciate a sample query 😀

If you need any further clarifaction I would be happy to provide them.

Thanks

The way Table A is setup now:

`table_a_id` VARCHAR ( 6 ) NOT NULL,
`table_b_ids` TEXT NOT NULL, -- This is a comma seperated list at the moment
-- More data here that is irrelevant to this question but i am grabbing

Table B is setup like this:

`table_b_id` VARCHAR ( 6 ) NOT NULL,
`name` VARCHAR ( 128 ) NOT NULL,
-- More data that is not relevant to the question

Also I want to eventually switch to a NOSQL system like Cassandra, from what I have briefly read I understand there are no such things as joins in NOSQL? A bonus help would be to help me to setup these tables so I can convert over with less conversions and difficulty.

  • 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-09T12:52:54+00:00Added an answer on June 9, 2026 at 12:52 pm

    You need to add another table.

    Person -- your Table A
    ------
    PersonID 
    
    Thing -- your Table B
    ------
    ThingID
    ThingName
    
    PersonThing -- new intersection table
    -------
    PersonID
    ThingID
    

    Then your query becomes

    SELECT * from Person
    INNER JOIN PersonThing ON Person.PersonID = PersonThing.PersonID
    INNER JOIN Thing ON PersonThing.ThingID = Thing.ThingID
    

    So where now you have

    001 | Sam Spade | 12,23,14
    

    You would have

    Person
    001 | Sam Spade
    
    Thing
    12 | box
    23 | chair
    14 | wheel
    
    PersonThing
    001 | 12
    001 | 23
    001 | 14
    

    This is what the other answers mean by “normalizing”.

    Edited to add

    From what I understand of NoSQL, you would get around the joins like this:

    Person -- your Table A
    ------
    PersonID
    OtherPersonStuff
    
    Thing -- your Table B
    ------
    ThingID
    ThingName
    OtherThingStuff
    
    
    PersonThing -- denormalized table, one record for each Thing held by each Person
    -------
    PersonID
    ThingID
    ThingName
    OtherThingStuff
    

    In exchange for taking up extra space (by duplicating the Thing information many times) and potential data management headaches (keeping the duplicates in sync), you get simpler, faster queries.

    So your last table would look like this:

    PersonThing
    001 | 12 | box   | $2.00
    001 | 23 | chair | $3.00
    001 | 14 | wheel | $1.00
    002 | 12 | box   | $2.00
    003 | 14 | wheel | $1.00
    

    In this case OtherThingStuff is the value of the Thing.

    • 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 has some product details, the other holds various photos
I have two tables, one is a table of forum threads. It has a
I have two tables. One (Widgets) has a list of widgets (ID, widget_name, color,
I have two tables. One has album information, and the other is actual copies
I have 8 separate tables. Each table has id, a datetime field and some
I have one table that has two fields - ID1 and ID2 ID1 can
Suppose I have two tables that are linked (one has a foreign key to
I have two tables, one that has 450 rows, the other is a Sort
I have two tables, one that has a foreign key from the other. I
I have two models. one is brand and another is product_detail. brands table has

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.