Hello,
I have a stored procedure that looks similar to the one below:
How could I set a variable I declare @match, to different values based on how they were matched up in the AND(a.value = b.value OR ... etc. statement ? Also if one matched for one or more how I could I handle that case. The desired result is below:
#temp would be a temporary table with columns id and match
select * from #temp
If it only matched on a
( (1), ("a") )
if it matched on a and b
( (2), ("a,b") )
if it matched on all three
( (3), ("a,b,c") )
and so on...
If anyone has a good example of a stored procedure with such functionality that would be very helpful.
Thanks
I have a stored procedure that looks similar to the one below:
Code:
Select * from table a inner join table b on a.id = b.id inner join table c on b.id = c.id AND (a.value = b.value OR a.value = c.value OR b.value = c.value)
#temp would be a temporary table with columns id and match
select * from #temp
If it only matched on a
( (1), ("a") )
if it matched on a and b
( (2), ("a,b") )
if it matched on all three
( (3), ("a,b,c") )
and so on...
If anyone has a good example of a stored procedure with such functionality that would be very helpful.
Thanks