I need to find intersect value from two comma separated string in stored procedure.
String 1: 40,31,42,23,45 => System generated numbers
String 2: 30,23,24,31,25,32 => User selected numbers
I want to check that, do any of my numbers are present in system generated numbers.
Above value should return 23,31.
I have solution that, i will loop through system generated numbers and will check one by one with my numbers using FIND_IN_SET, if present i will CONCATE that and will get required output.
But is there any shorter and optimized way to do this?