Link to home
Start Free TrialLog in
Avatar of nyk001
nyk001

asked on

SQL Statement for checking items in field with many IDs (seperated by comma)

Hi,

I have a table setup as below:

Name: TABLE1
Fields: TABLE1_ID int, primary key, Is Identity
           TABLE1_ITEMS nvarchar (50)

Sample Data:
 TABLE1_ID               |               TABLE1_ITEMS
-----------------------------------------------------------
               1                 | 8, 14, 73, 98
-----------------------------------------------------------
               2                 | 18, 47
-----------------------------------------------------------
               3                 | 3, 8, 9, 14, 19

Is there a logical SQL Query which can select all the records from TABLE1 where the number '8' is within the range of numbers in the TABLE_ITEMS?

So in this case record 1 and 3 would match but record 2 would not.

Any help would be appreciated.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Binuth
Binuth
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial