I don't really understand why doing AdditinalStyles in @Param works since it works out like the example below in the data.
AdditionalStyles = 'XC,FR,AM'
@Param = 'AM'
The query then looks like this.
'XC,FR,AM' IN 'AM'
This I don't understand.
Sorry, but I didn't understand your last question.
But anyway let me explain this:
Assume that the Fork table contains 3 Rows only, which have the following values for AdditionalStyles:
1- 'A,B,C'
2- 'X,Y,Z'
3- 'L,M,N'
And you want to query for X (@frameStyleCode='X')
So the following Where condition:
@frameStyleCode IN (SELECT AdditionalStyles FROM dbo.Fork WHERE ForkID = F.ForkID)
will examine to see,
if 'X' == 'A,B,C' // which is not
if 'X' == 'X,Y,Z' // which is not
if 'X' == 'L,M,N' // which is not
So for this kind of string to subString comparing, we should use "Like %String%".