2

I have a database table,in one Column I have data Like:

id      tags
1       1.2,2.2,22.2
2       20.1,30.1,45.2,46.0,55.3 
3       1.3,6.1,7.2,9.4,10.2

I want to search ids having num 1 in tag's Column

2 Answers 2

2

Use LIKE operator to search the data

SELECT id 
FROM tableA 
WHERE tags LIKE '%1%'
Sign up to request clarification or add additional context in comments.

Comments

1

Just another using INSTR when wildcard is on both sides in a LIKE search!

SELECT id
FROM tableA
WHERE INSTR(tags,'1') > 0 ;

2 Comments

Why INSTR? Which Best INSTR or LIKE
in your case both are same! when you expect the letter to be in x location, INSTR wins. LIKE wins, when the wildcard is given only at end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.