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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:03:58+00:00 2026-05-15T20:03:58+00:00

A little background so you understand what I’m trying to do. I am making

  • 0

A little background so you understand what I’m trying to do. I am making a page that takes two user input products and checks to see if they are compatible with one another. This is an n+1*n mySQL table because there are n products.

The table looks like

name    a    b    c    d    e
a
b
c
d
e

I already know that every product is compatible with itself, so to save time, is there a query that will automatically fill the table out so that I can get

name    a    b    c    d    e
a       1
b            1
c                 1
d                      1
e                           1

Thanks

I forgot to mention, each product can be compatible with an several other products. The diagonal I’m putting in is just a starting point.

  • 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-15T20:03:59+00:00Added an answer on May 15, 2026 at 8:03 pm

    Not a direct answer to your question but I felt I had to mention it…

    If possible you should consider changing your design to the following:

    compatible_products
    product1 product2
    a        b
    a        c
    b        d
    etc...
    

    If you insert rows for both (a, b) and (b, a) then your query is simple:

    SELECT 1
    FROM compatible_products
    WHERE product1 = 'a' AND product2 = 'b'
    

    Also, when you add new products you won’t have to change your database schema.

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

Sidebar

Related Questions

Ok guys so a little background... I'm writing a small application that will assign
First, a little background. I have strings that resemble the following: ((Foo.Bar.StartsWith(A)) && (Foo.Bar.EndsWith(B)))
Relevant background info I've built a little software that can be customized via a
I have a little tool on a web page that can be clicked and
A little background: I've got a library of C code that is part of
A little background info - I'm trying to host a RESTful WCF service on
I'm trying to understand un-managed code. I come from a background of C# and
A little background first: I'm designing a web application for a control system that
A little background: I am loading a WPF UI from a database which is
A little background first. I've been tasked with encrypting files with a Powershell script

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.