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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:53:27+00:00 2026-05-30T00:53:27+00:00

I have the following table and I want to retrieve students ( STUD_ID )

  • 0

I have the following table and I want to retrieve students (STUD_ID) who have taken either ENGLISH or SCIENCE. If they have taken both ENGLISH and SCIENCE, then do not retrieve.

So the desired output is 101,102,104,106,107

The table is actually a View with the first 2 columns from the table STUD_INFO and the subject column are from a Nested table within the STUD_INFO table.

SELECT groupid, 
       Stud_id, 
       NST.Name
  FROM STUD_INFO, 
       TABLE(SUBINFO) NST

Can anyone help me with a SQL query? The interesting part is when I use
Subject = ENGLISH and Subject = Science it does not retrieve any data.

groupid Stud_id Subject
-------   -------   --------
1   101 ENGLISH
1   102 MATH
1   103 ENGLISH
1   103 SCIENCE
1   104 ENGLISH
1   104 MATH
1   105 PT
1   105 ENGLISH
1   105 SCIENCE
2   106 ENGLISH
2   107 SCIENCE
2   108 SCIENCE
2   108 ENGLISH
  • 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-30T00:53:29+00:00Added an answer on May 30, 2026 at 12:53 am

    Subject = ENGLISH and Subject = SCIENCE says “Subject needs to be both ENGLISH and SCIENCE at the same time” which can never be true.

    select stud_id from your_view
    where subject in ('ENGLISH', 'SCIENCE')
    group by stud_id
    having count(subject) = 1
    

    Does this work for you?

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

Sidebar

Related Questions

I have 4 tables with the following relevant information I want to retrieve. Table:
I have the following table: I want to insert values from the MySQL workbench.
I have the following table in my database. Now what I want to find
I have following data in my table. alt text http://img26.imageshack.us/img26/3746/productfield.png I want to extract
I have the following view and table in my project, vw_get_arabia_upod_full_details arabia_upod_item_avalability_master I want
I have the following situation. We want an reputation table to evaluate Users And
I have a table with the following columns: EntityId, EntityName, EntityProfile, ................. I want
I want to select from the following table all the rows which have similar
i have the following code. my problem is i want to retrieve each employee
I have the following recursive table-valued function in MS SQL, in order to retrieve

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.