Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ssd_123
Starting Member
2 Posts |
Posted - 2004-09-09 : 09:46:06
|
Hello,I have a table as shown below. I need to write a sql query that tellsme what courses are common between Tom and Jim.Name CourseID-------------Tom 1Tom 2Tom 3Jim 1Jim 3Jim 4Output needs to something like:CourseID--------13Appreciate all your help.Thanks, Subhash |
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-09-09 : 09:54:01
|
Something likeSELECT distinct a.courseid from yourtable aINNER JOIN yourtable bON a.courseid = b.courseidand a.name <> b.name-------Moo. :) |
|
|
ssd_123
Starting Member
2 Posts |
Posted - 2004-09-10 : 11:28:56
|
Perfect! Thanks |
|
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-09-10 : 11:38:44
|
Sounds like a homework question. |
|
|
|
|
|