Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

ORing or ANDing with INNER and OUTER joins Expand / Collapse
Author
Message
Posted Friday, August 8, 2008 8:29 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, May 20, 2013 6:07 AM
Points: 78, Visits: 171
Hi

can we do add OR or AND in INNER and OUTER joins conditions..?
if anybody has any clue, please reply.

Post #549240
Posted Friday, August 8, 2008 8:42 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 26, 2012 5:26 AM
Points: 1,367, Visits: 1,585
sanjeev_krs2004 (8/8/2008)
Hi

can we do add OR or AND in INNER and OUTER joins conditions..?
if anybody has any clue, please reply.



Yes, you can. The following (absolutely useless in terms of the result) query shows it:

select  c.name
from sys.objects as o
join sys.columns as c on o.object_id = c.object_id
OR ( (o.object_id = c.object_id
AND o.object_id = 4) )

Regards,
Andras




Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Post #549260
Posted Friday, August 8, 2008 8:58 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 15,444, Visits: 9,596
You can put anything you'd put in a Where clause, into a join clause. Some things might be a bad idea, but you can technically do it.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #549290
Posted Wednesday, June 16, 2010 4:08 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 4, 2014 5:16 AM
Points: 211, Visits: 1,115
GSquared (8/8/2008)
You can put anything you'd put in a Where clause, into a join clause. Some things might be a bad idea, but you can technically do it.



but if we analyze its impact on performance then it may not be bad idea at all?
what u suggest by your expertise ?

Focus in Performance only!

Post #938026
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse