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
 General SQL Server Forums
 New to SQL Server Programming
 inner join with where is not comming

Author  Topic 

sivasankarp
Starting Member

4 Posts

Posted - 2010-02-01 : 02:22:02
Hi friends,

Member_Registration
MemberID,Name,Areaname

Event
EventID(IDentity),EventName

Evnet_Registration
ERID(IDentity),EventID,MemberID,Status

Course
CourseID(IDentity),CourseName

Course_Registration
CRID(Idetity),CourseID,MemberID,Status


select r.MemberID,r.Name e.EventName,c.CourseName from Member_Registration as r inner join Evnet_Registration as er on er.MemberID=r.MemberID inner join
Event as e on er.EventID=e.EventID inner join Course_Registration as cr on cr.MemberID=r.MemberID inner join Course as c on cr.CourseID=c.CourseID where
er.Status=1 and cr.status=1 and area='Hyderabad'

my result is
102 s C# only coming need both with null


MemberID EventName CourseName
101 s --
102 s C#


Sivasankar puppala

raky
Aged Yak Warrior

767 Posts

Posted - 2010-02-01 : 03:49:39
try this

select r.MemberID,r.Name e.EventName,c.CourseName
from Member_Registration as r
inner join Evnet_Registration as er on er.MemberID=r.MemberID
inner join Event as e on er.EventID=e.EventID
left join Course_Registration as cr on cr.MemberID=r.MemberID and cr.status=1
left join Course as c on cr.CourseID= c.CourseID
where er.Status=1 and area='Hyderabad'
Go to Top of Page

sivasankarp
Starting Member

4 Posts

Posted - 2010-02-01 : 04:31:57
Thanks for replay

It's working, I want to include filters like search by name ..




Thanks

Sivasankar puppala
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-01 : 04:41:21
quote:
Originally posted by sivasankarp

Thanks for replay

It's working, I want to include filters like search by name ..




Thanks

Sivasankar puppala


just add them in where condition using and like

and searchname = @name
Go to Top of Page
   

- Advertisement -