MySQL Forums
Forum List  »  Newbie

A select statement challenge
Posted by: Danny McAlerney
Date: April 06, 2006 03:25PM

Hello All,

I'm having a hard time with a query and I thought someone might have a good time taking a crack at it.

I have a table that we'll call Options.

it looks like this.

style int
sequence int
optionCode varchar
optionDesc tinytext

There are no keys in this table. (i didn't make it and I can't augment the schema).

Here's a sample of what the table might look like
<code>
style......sequence......optioncode......optiondesc
-----......--------......----------......----------
276........15............AAA.............lah de dah
279........25............AAA.............do de do
333........08............BBB.............lah de dah
276........25............BBB.............do de do
277........15............BBB.............lah de dah
276........25............CCC.............do de do
250........15............CCC.............lah de dah
276........25............DDD.............do de do
280........15............DDD.............lah de dah
279........25............DDD.............do de do
</code>
What I want to do is ultimately choose the style ID that has all of it's option codes within this list ('AAA', 'BBB', 'CCC', 'DDD') Right now (since I made this fake table) I know that style I want is 276.

276 shows that it has all 4 of those option codes spread out on 4 different rows. Other styles have *SOME* of those option codes, but not all of them.

How would I select that single style that contains All the values in that list without selecting the styles that conatin SOME of those values.


Good Luck,
Danny


+++UPDATE+++
This was solved by the query provided in the second thread of this convesation. Thanks!




Edited 1 time(s). Last edit at 04/06/2006 04:11PM by Danny McAlerney.

Options: ReplyQuote


Subject
Written By
Posted
A select statement challenge
April 06, 2006 03:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.