pattern matching - SQL Server Query to find records with exact numbers in string -



pattern matching - SQL Server Query to find records with exact numbers in string -

i querying against column has info follows

winners - 1,2,3,4,5,6,21,24 / 2,8,11,21,22,24 / 12,13,15,16 / 12,13,15,21,24 winners - 2,5 / 2,5 / 1,6,11,12,22,24 / 1,11,12,22,24 winners - 1,3,5 / 1,3,5 / 4,8,11 / 2,12,14,16,21

how find ones 2 or 6 in of 4 blocks have? have query follows

select * scores results 'winners - %[2,6]%/%[2,6]%/%[2,6]%/%[2,6]%'

but returns ones match 21, 12, 26, 16 , on. want match 2 or 6.

i sure there improve way don't know here 2 solutions

select * scores ((replace(replace(result,'winners - ', ','), ' / ', ',') + ',') '%,2,%' or (replace(replace(result,'winners - ', ','), ' / ', ',') + ',') '%,6,%') , result 'winners - %' select * scores (result '% 2%' or result '% 6%' or result '%,2 %' or result '%,6 %' or result '%,2,%' or result '%,2' or result '%,6') , result 'winners - %'

sql-server pattern-matching

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -