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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:58:38+00:00 2026-06-12T01:58:38+00:00

Prod_Oth_Id ||| Prod_Code ||||| Prod_Details |||||||||| Prod_Value | 1 | BR25MAON | 4 |

  • 0

Prod_Oth_Id ||| Prod_Code ||||| Prod_Details |||||||||| Prod_Value |

    1     | BR25MAON  | 4            | 9          |
    2     | BR25MAON  | 5            | 10         |
    3     | BR25MAON  | 6            | 11         |
    4     | BR25MABO  | 4            | 9          |
     5    | BR25MABO  | 5            | 10         |
     6    | BR25MABO  | 6            | 17         |
     7    | BR25GLON  | 4            | 9          |
        8 | BR25GLON  | 5            | 16         |
        9 | BR25GLON  | 6            | 11         |
       10 | BR25GLBO  | 4            | 9          |
       11 | BR25GLBO  | 5            | 16         |
       12 | BR25GLBO  | 6            | 17         |

I have combination of 3 prod_value for eg 9,10,11
& I want to retrieve prodcode for for above combination which is BR25MAON

for eg if I got 9, 16, 17 then I must retrieve prodcode for this combination which is BR25GLBO

  • 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-12T01:58:40+00:00Added an answer on June 12, 2026 at 1:58 am

    You can count the matches and non matches, if there are 3 Prod_Values to match, there should be 3 matches and 0 non matches;

    # 9, 10, 11
    
    SELECT DISTINCT a.Prod_Code FROM MyTable a GROUP BY Prod_Code
    HAVING SUM(a.Prod_Value NOT IN (9,10,11)) = 0               # <-- No non matches
       AND SUM(a.Prod_Value     IN (9,10,11)) = 3;              # <-- 3 matches
    

    If you for example were matching (1,2), the query would change to;

    # 1, 2
    
    SELECT DISTINCT a.Prod_Code FROM MyTable a GROUP BY Prod_Code
    HAVING SUM(a.Prod_Value NOT IN (1,2)) = 0                   # <-- No non matches
       AND SUM(a.Prod_Value     IN (1,2)) = 2;                  # <-- 2 matches
    

    SQLfiddle demo

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

Sidebar

Related Questions

I have a simple table of installs : prod_code email install_slot If the install_slot
i have a database like this prod_id prod_name catogory_1 catogory_2 catogary_3 now i want
I have the following SQL query SELECT tbl_product.prod_id, ISNULL (prod_code, '') AS prod_code, ISNULL
Let's say I have two directory structures: /var/www/site1.prod /var/www/site1.test I want to use find(1)
I have two tables 1.Products prod_id prod_name 1 honda 2 hero 3 marcedes 4
I have the following XPATH line: //det[@nItem=1]/prod/cProd That successfully selects the desired node using
I have the following scenario in my TFS: MyTeamProject Trunc Sources Scripts Installations Prod
I have a MySQL table called invoice_prod : id | qte | price |
Let's say I have a (fairly typical) set of environments: PROD, UAT, QA, DEV
So I want to copy just the data from a Prod database (SQL 2005)

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.