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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:54:19+00:00 2026-05-27T07:54:19+00:00

One column in my data is sample , another is category . Duplicate are

  • 0

One column in my data is sample, another is category. Duplicate are allowed. Number of unique categories I currently have is 5. Here is a simplified example:

sample category other_columns
122    a
123    a
124    a
125    a
123    b
124    b
125    b
122    c
123    c
124    c
...    ...

I need to select only those samples that exist in all categories (122 is not in ‘b’ and 125 is not in ‘c’).

sample category
123    a
124    a
123    b
124    b
123    c
124    c

So, if I run

SELECT category, COUNT(DISTINCT sample, category)
FROM my_table
GROUP BY category

all counts should be the same.

  • 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-27T07:54:20+00:00Added an answer on May 27, 2026 at 7:54 am

    This one should do the trick:

    SELECT sample 
    FROM my_table 
    GROUP BY sample
    HAVING count(DISTINCT category) >= (SELECT count(DISTINCT category) FROM my_table);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have a data frame where one particular column has a set of specific
I need to have one column as the primary key and another to auto
I have a table where one column has duplicate records but other columns are
I have a problem using data.table: How do I convert column classes? Here is
I want to store a data structure thats a table with one column Strings
I'm trying to pull data using a SqlDataReader, one column of which is in
by default I have one column in MySQL table to be NULL. I want
I have a GridView where one column is bound to an object property containing
I have multiple columns in a table One column may contain the name of

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.