×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Select query where it finds ids taking certain classes but not other classes

Select query where it finds ids taking certain classes but not other classes

Select query where it finds ids taking certain classes but not other classes

(OP)
table CLASS:

id subject course# section#

1 TEST 1 1
1 TEST_2 3 3

2 TEST 4 4
2 ART 1000 5


My query would need to find ids that have taken TEST or TEST_2 classes but not a non-TEST class so it would only retrieve id "1" since id "2" took an ART class.

I hope I gave enough information.

Thanks

RE: Select query where it finds ids taking certain classes but not other classes

Kernal,

Please post the code you have come up with so far.

santaMufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel."

RE: Select query where it finds ids taking certain classes but not other classes

bigsmileNice post Santa, I seem to recall that problem from one of my Oracle classes.

profile

To Paraphrase:"The Help you get is proportional to the Help you give.."

RE: Select query where it finds ids taking certain classes but not other classes

(OP)
I don't have much in the select query only:

select * from class where subject like "TEST%" order by id, subject, course, section

Thanks

RE: Select query where it finds ids taking certain classes but not other classes

Kernal,

A functional narrative of your code, above, is:

Quote:

  • Read the CLASS table.
  • Return only rows that begin with the string, 'TEST'.
  • Sort the results by ID, SUBJECT, COURSE, and SECTION

Could you please enhance just the functional narrative to do what needs to happen to produce the results you want. Don't worry about syntax; worry only about the logic you need to produce what you want. If you create the logic, then we can help with the SQL syntax.

santaMufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close