I have TABLE A with one of the columns containing single value and TABLE B with one of the columns containing list of possible matching values.
My code seems to take only first items in the list but does not go deeper within a list to find matching number.
Can you please help me to improve following code:
select Logs.SingleValue,
Instances.list from Logs,Instances
where Logs.Column1=Instances.DeviceNumber and
(',' + RTRIM(Instances.list) + ',') LIKE Logs.SingleValue
The data in the list looks like
106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120
or
3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360
I use SQL withn R progrograming enviorment not sure whats version it is weather MS SQL or ORACLE. All I know that I have found similar case and the command did not work so it needs to be hand wrtien in pure SQL.
Thanks in Advance