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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:17:06+00:00 2026-05-24T17:17:06+00:00

I am using Oracle 10g Here is my scenario: I have two tables class1(groupName,

  • 0

I am using Oracle 10g
Here is my scenario:

I have two tables

class1(groupName, subgroup)
class2(groupName, subgroup, ind)

Here is my data looks like:

class1
groupName  subgroup
     A      1
     A      2
     B      3
     C      4
     C      4
     C      5
     D      6


class2
groupName  subgroup IND
     A      1        Y     
     A      1        N
     A      2        Y
     A      2        N
     B      3        Y
     C      4        Y
     C      4        N

Now, I need to get the data that has the matching groupName and subGroup in both class1 and class2(Not necessarily distinct match). In addition to that the IND column should have pair of ‘Y’ and ‘N’ value for each subgroup in class 2. Eg.In the above example GroupName A is qualified because A exists in both class1 and class2 and it has subgroup 1 and 2 exist in both class1 and class2 and IND column in class2 table has a pair of ‘Y’ and ‘N’ for each subgroup (i.e 1 and 2).

Rest of the records are not qualified because : Group B has subgroup 3 that exists in both class1 and class2 but it does not have ‘Y’ and ‘N’ pairs for subgroup 3 in class2. Group C and D are not qualified because its all subgroup (4,5) doesn’t exist in class2.

I have more than 700,000 records on both table class1 and class2. Anyone has any idea what is the effective way to get this information.

  • 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-24T17:17:06+00:00Added an answer on May 24, 2026 at 5:17 pm

    Does this create what you need?

    SELECT *
    FROM class1 c1
    JOIN class2 c2 ON c1.groupName = c2.groupName
            AND c1.subgroup = c2.subgroup
    WHERE
        (
        SELECT COUNT(DISTINCT ind)
        FROM class2 c2a
        WHERE c2a.groupName = c1.groupName
            AND c2a.subgroup = c2a.subgroup
        ) = 2
      AND
        (
        SELECT COUNT(DISTINCT subgroup)
        FROM class1 c1b
        WHERE c1b.groupName = c1.groupName
        ) =
        (
        SELECT COUNT(DISTINCT subgroup)
        FROM class2 c2b
        WHERE c2b.groupName = c2.groupName
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using oracle database. Here's how i think the SQLException happens... Say i have two
I have two very large enterprise tables in an Oracle 10g database. One table
I am using oracle 10g. I tried to merge two tables. At that time
I am using Oracle 10g and I have the following stored procedure: CREATE OR
We are using the default Oracle ADF Faces 10g default skin. It looks super
I have been using Oracle(10g.2) as a PHP programmer for almost 3 years, but
I've inherited a working Oracle (10g) to SQL Server 2005 data replication using standard
I am using Oracle 10g. Here is my query select * from Entries where
I am using hibernate 3 , oracle 10g. I have a table: subject. The
I'm using Oracle 10g. If i have the following duplicate rows ( Same Employee

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.