Hi everybody,
I have a problem selecting rows where column is equal to multiple values. I have my database table in this format. What i want is, i want to select those users having the courseid 1 and courseid 2 and dateid 1 and dateid 4. I tried this using select field from table where values in(v1,v2) but didnt worked since in uses OR method.
Any suggestion and help would be greatly appreciated.
userid | name | email
-----------------------
1 | abc | a@a.com
2 | bcd | b@b.com
3 | def | c@c.com
courseid | name
---------------
1 | c1
2 | c2
dateid | date | courseid
------------------------
1 | 2010-1-1 | 1
2 | 2010-2-1 | 1
3 | 2010-3-1 | 1
4 | 2010-1-2 | 2
5 | 2010-2-3 | 2
6 | 2010-3-4 | 2
courseid | dateid | userid
---------------------------
1 | 1 | 1 <== this one
1 | 2 | 2
1 | 3 | 3
2 | 4 | 1 <== and this one
2 | 5 | 2
2 | 6 | 3