Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
how do i write this query by using JOIN..instead of writing this select statement..i want to use join
select assignment.cid,trainer.username,assignment.trainerid,class.cid from assignment,trainer,module,class where username='"+Session["uname"].ToString()+"'and assignment.trainerid=trainer.trainerid AND module.mid=assignment.mid and class.cid=assignment.cid"
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts
Posted - 2006-10-08 : 06:32:35
[code]select assignment.cid,trainer.username,assignment.trainerid,class.cid from assignment Inner Join trainer On assignment.trainerid=trainer.traineridInner Join module On module.mid=assignment.midInner Join class On class.cid=assignment.cidwhere username='"+Session["uname"].ToString()+"'"[/code]Chiraghttp://chirikworld.blogspot.com/
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts
Posted - 2006-10-08 : 06:37:22
Also you can read on BOL, under Join -SQL Server Section. This will give you better understanding on the differnt types of join and their implementations.Chiraghttp://chirikworld.blogspot.com/