The classic way would be to add commas to the left and right:
select * from shirts where CONCAT(',', colors, ',') like '%,1,%'
But find_in_set also works:
select * from shirts where find_in_set('1',colors) <> 0
More Related Contents:
- In MySQL queries, why use join instead of where?
- SQLite INSERT – ON DUPLICATE KEY UPDATE (UPSERT)
- Can table columns with a Foreign Key be NULL?
- MySQL not using indexes with WHERE IN clause?
- MySQL dump by query
- single fixed table with multiple columns vs flexible abstract tables
- How many rows in a database are TOO MANY?
- SQLite – ORDER BY RAND()
- SQL – How to transpose?
- Which SQL query is better, MATCH AGAINST or LIKE?
- MySQL equivalent of DECODE function in Oracle
- How to delete Duplicates in MySQL table
- Best database field type for a URL
- Query that ignore the spaces
- How to Optimize Queries in a Database – The Basics
- MySQL – how to front pad zip code with “0”?
- Create date from day, month, year fields in MySQL
- Find rows that have the same value on a column in MySQL
- what is the difference between GROUP BY and ORDER BY in sql
- How do I list all the columns in a table?
- Two single-column indexes vs one two-column index in MySQL?
- VARCHAR as foreign key/primary key in database good or bad?
- How to find all IDs of children recursively?
- How to select the nth row in a SQL database table?
- Simple way to calculate median with MySQL
- MySQL “NOT IN” query
- Emulate MySQL LIMIT clause in Microsoft SQL Server 2000
- What is the purpose of constraint naming
- Multiple Ranks in one table
- Comma separated values in a database field