I have table branch and an another table pincode with a column which can contain pincode IDs separated with comma as varchar data type. I want to Select related pincodes based on branch id but I'm getting error "Conversion failed when converting the varchar value '1,3,5,' to data type int." when trying to select:
SELECT Pincode from tblpin where pinID in (select pinid from branch where brnchID='1');
The subquery returns data like "1,3,5"