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 |
Prosercunus
Starting Member
22 Posts |
Posted - 2012-10-09 : 05:56:15
|
I have two tables. One called "Prof" and one called "Dept"The Prof table has the columns "pname" (Professor Name) and "dname" (Department Name)The Dept table has the columns "dname" (Department Name) and "numphds" (Number of PhD's)Of course this causes me Ambiguous column name 'dname'. which I understand because it shares the same named column "dname"How do I properly write the select statement to find names of professors who work in departments that have fewer than 50 PhD students.I know it is something to do with assignments, but I am confused. Thanks. |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2012-10-09 : 06:01:07
|
Specify with table name Prof.dname / Dept.dnameSenthil Kumar C------------------------------------------------------MCITP - Database Administration SQL SERVER 2008MCTS - Database Development SQL SERVER 2008 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-10-09 : 06:05:39
|
select p.pname, d.numphdsfrom Prof as pjoin Dept as d on d.dname = p.dname and d.numphds < 50 Too old to Rock'n'Roll too young to die. |
|
|
Prosercunus
Starting Member
22 Posts |
Posted - 2012-10-09 : 06:08:16
|
You guys are awesome. Thank you. |
|
|
|
|
|