ORing or ANDing with INNER and OUTER joins

  • Hi

    can we do add OR or AND in INNER and OUTER joins conditions..?

    if anybody has any clue, please reply.

  • 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

  • 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

  • [font="Verdana"]

    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!

    [/font]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply