If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: A Challenging SQL Question

Hey guys,

I have a table t with two columns: entryID and catID with the following sample data:

Code:

entryID catID
1 10
2 10
2 11
3 11
3 15
3 16
4 10
4 11

I want a select statement to retrieve those entryIDs that their catIDs are in a list, let's say: 10 and 11. In this case it should bring entryIDs 2 and 4.
Actually, we don't know in advance the list of the catIDs, so maybe we ask to bring those entryIDs that has catIDs 11 and 15 and 16. In this case it should bring the entryID 3.
The way that we can provide the list is a comma separated string like "10,11" in the first case and "11, 15, 16" in the second case.

Thank you so much Shammat for your response.
I think I should have posted my question in the MySQL section because currently, I am using it.
Anyway, as far as I know, MySQL doesn't support With clause, so, how can you make an equivalent for your code for MySQL?