How to use comma separated values column in where clause to compare with other table column?

TableA is having testrequested (varchar)column.
TableB is having field_varchar_02(varchar) column, Days(integer)
TableA and TableB:
TableA

select B.days from TableA as A, TableB as B where A.testrequested=B.testrequested.

TableB testrequested column having comma separated values how to achieve this in where clause.

As Table "B" currently stands, you'll either need to use LIKE with concatenated commas on both the Table "A" and Table "B" reference, which will kill all possibilities of and Index Seek, or use a splitter function on Table "B".

The best thing to do, though, would be to normalize Table "B".

1 Like