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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 JOIN query

Author  Topic 

princess82
Starting Member

10 Posts

Posted - 2006-10-08 : 06:07:17
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.trainerid
Inner Join module On
module.mid=assignment.mid
Inner Join class On
class.cid=assignment.cid
where
username='"+Session["uname"].ToString()+"'"
[/code]

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

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.


Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -