mySQL search for a number in VARCHAR field
Posted
by sea_1987
on Stack Overflow
See other posts from Stack Overflow
or by sea_1987
Published on 2010-04-09T10:45:16Z
Indexed on
2010/04/09
10:53 UTC
Read the original article
Hit count: 287
Hi There,
I have a field in my database that contain comma seperated values these values are numbers, and I am trying to do a search and count the number of times that a number appears in that column throughout the column,
$sql = "SELECT sector_id_csv, COUNT(sector_id_csv) as count FROM cv WHERE sector_id_csv LIKE '$sectorId'";
This seems slow and does not return any results, and I know the sector_id it is search exsists in the table.
© Stack Overflow or respective owner