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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:01:39+00:00 2026-05-26T00:01:39+00:00

I have two tables, in one the tables there is a column that holds

  • 0

I have two tables, in one the tables there is a column that holds the ID of the other table. This column could hold more than one ID so I am storing it as a list so for instance “1,2,3,4” could be the values. So I try to use the following:

SELECT TableAValue
FROM TableA
WHERE TableAID IN 
(SELECT TableAID FROM TableB WHERE TableBID  = 1) 

This only brings back one value.

Now if I use:

SELECT TableAID FROM TableB WHERE TableBID  = 1

This brings back four values. Also if I copy those four values and use:

SELECT TableAValue
FROM TableA
WHERE TableAID IN 
(1,2,3,4) 

This will bring back the four values I am after. This seems like something very simple to do, so I guess I’m either doing it completely wrong or I’m missing some small detail. Any ideas?

  • 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-26T00:01:40+00:00Added an answer on May 26, 2026 at 12:01 am

    As mentioned in the comments discussion, your mistake is to hold four values in a single field. Doing so means that you’re holding a string, a single value, not a list of integers. If you want to hold several values, you need several places to hold them individually.

    So, if instead you have four records, each with a different value in TableAID, it will work exactly as you expect.

    CREATE TABLE TableB (
      TableBID INT,
      TableAID INT
    )
    
    INSERT INTO TableB
          SELECT 1, 1
    UNION SELECT 1, 2
    UNION SELECT 1, 3
    UNION SELECT 1, 4
    UNION SELECT 2, 3
    UNION SELECT 2, 4
    UNION SELECT 2, 5
    UNION SELECT 2, 6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that joins two tables. One table has a column that
I have two tables : one table it matchs and the other is teams.
I have two product tables Product1 and Product2. There is a one 2 one
In my html page, I have one table, for every row there are two
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables one called fs_note the other called dumy_fs_note I created after
i have two tables one is called addons and holds information about different addons,
I have two tables connected with one to many relationship. Parent Table is a
I have two tables that link together through an id one is submit_moderate and
I have two tables and their only difference is one column is missing from

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.