I need to have a case statement in within a JOIN. The condition needs to be a SELECT,Basically I need to see if records exist that matches a condition.If there are any records that match the condition then my JOIN with be XXIf the count of matching records is 0 then my JOIN is YYThe following code does not work but it will show I think what I need to accomplish.** This will be in a dynamic statement so I can not go set a variable and say if the variable > 0 kind of thing. I really need to SELECT this real time and make a decision based upon those results.The example is not exactly what the end result will be but if this works then I can adapt to what I actually need. Can someone please help??SELECT *FROM ETLCorrelation cJOIN ETLMapping as m on case (SELECT count(*) FROM ETLCorrelation WHERE DestinationTable = 'Node' AND SourceID <> DestinationID) when >1 (SELECT TOP 10 FROM ETLMapping) WHEN =0 (SELECT TOP 10 FROM EventLog) ELSE end as outcome
↧