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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:05:39+00:00 2026-06-15T18:05:39+00:00

I have a MYSQL table like this: STORES (SPID, StoreID, ProductID); And data like

  • 0

I have a MYSQL table like this:

STORES (SPID, StoreID, ProductID);

And data like this:

{ 1 | s1 | p2 }
{ 2 | s1 | p7 }
{ 3 | s1 | p8 }
{ 4 | s2 | p1 }
{ 5 | s2 | p3 }
{ 6 | s2 | p6 }
{ 7 | s2 | p9 }
{ 8 | s3 | p2 }
{ 9 | s3 | p5 }

And I would like to:
Use a MYSQL SELECT query to get results, where if a store has a certain product, then a list of all of the products at that store will be returned.
For example, if I were looking for “p2”, then I would like to know that “s1” has “p2, p7, p8” and “s3” has “p2, p5”.

Please let me know if you require any more information. I’m not sure what is required to solve this issue (Which is probably why I can’t search and find the answer!)

  • 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-15T18:05:41+00:00Added an answer on June 15, 2026 at 6:05 pm

    You can do this with a subquery:

    SELECT * FROM STORES WHERE StoreID IN (SELECT StoreID FROM Stores WHERE ProductID='p2')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql query like this SELECT id, dpost FROM uid1088_qposts UNION SELECT
I have a table (in MySQL) that stores votes. The structure is like this:
I have a MySQL table like this: Payments +----+---------------------+---------+ | id | date (sorted
I have a MySQL table looking like this: > describe books; +---------------+--------------+------+-----+---------+----------------+ | Field
I have a mysql table that looks like this: id col2 col3 col4 1
I have a MySQL table structured somewhat like this: type name value ===================== 1
I have a MySQL table that looks like this: `id` int(10) unsigned NOT NULL
I have this mysql table called comments which looks like this: commentID parentID type
I have a MySQL table that looks something like this: +-----+------------+ | id |
I have a mySQL table that has a column like this: ID ----- 0352

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.