Jump to content

Recommended Posts

Posted

BIyyas


can we write a sql to skip join condition depending upon a flag..

for example

if flag is 'Y' the skip a join condition and
if flag is 'N' execute the complete sql


help pleaseee

thanks

Posted

nee join condition ki flag condition 'AND' cheyu.
eg;
JOIN table1
ON flag ='N'
AND table1.col1=....your other conditions.

Posted

Flag values enni types untaii??? only Y and N a.. or more than tht aa???

if only two aithe or vere values unna just executing or not executing join anukunte ...
join condition raasi... where flag = N ( and more flags)...

inka vere ante.... help help

Posted

If flag = y
Begin
Print ' '
End

Else if flag= n
Begin
Join conditions
End

Ilaga if else condtions tho code cheyachu simple solution.

Posted

If flag = y
Begin
Sql code with out join
End

Else if flag= n
Begin
Sql code with join condition
End

Ilaga if else condtions tho code cheyachu simple solution.

Posted

use CASE stmt

Posted

CASE
when Flag = Y then Join
when FLag = N then no join
end as Col

×
×
  • Create New...