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
 About the sub query

Author  Topic 

hariharanpalani
Starting Member

2 Posts

Posted - 2006-05-09 : 06:38:56
Hi
In my procedure, right now i am using left outer join to retrieve the rows according to the conditions. Whether any alternate way like sub queries can be written to retrieve the rows.
For ref, i have given the query also.

Among joined tables(i.e,dbo.RTS_TBLALERTTITLES,dbo.RTS_tblAlertUsers) , any one of the table will have records respect to the parent table(dbo.RTS_INCIDENTALERTS)
/********************************************************************************************************/
SELECT dbo.RTS_INCIDENTALERTS.AlertID, dbo.RTS_INCIDENTALERTS.Name, dbo.RTS_INCIDENTALERTS.IncidentEntityID,
dbo.RTS_INCIDENTALERTS.OrganizationEntityID, dbo.RTS_INCIDENTALERTS.NumberOfDays,
dbo.RTS_INCIDENTALERTS.SeverityID,
dbo.RTS_INCIDENTALERTS.StatusID,
dbo.RTS_tblAlertUsers.RoleID AS ALERTROLES, dbo.RTS_TBLALERTTITLES.TitleID
FROM dbo.RTS_INCIDENTALERTS LEFT OUTER JOIN
dbo.RTS_tblAlertUsers ON dbo.RTS_INCIDENTALERTS.AlertID = dbo.RTS_tblAlertUsers.AlertID LEFT OUTER JOIN
dbo.RTS_TBLALERTTITLES ON dbo.RTS_INCIDENTALERTS.AlertID = dbo.RTS_TBLALERTTITLES.AlertID



hariharanpalani

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-09 : 06:53:28
why do you want to use Sub Query?? Are you not getting expected output??

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-05-09 : 12:50:12
Performance is much better using the JOIN ON condition instead of sub select so I'd stick with it.

Hope it helps,
Dalton

Blessings aren't so much a matter of "if they come" but "are you noticing them."
Go to Top of Page
   

- Advertisement -