sql - MYSQL find INT in string -
i have column mediumtext contains values come goup_concat, in form of int,int,int . can call concatenated_ids
the length of string can of 1 int or more.
i need break down original values somehow able such
select table_country.name table_country table_country.country_id in ( select concatenated_ids table_targeted_countries table_targeted_countries.email "%gmail.com") and country names users registered gmail address target.
i have considered exploding mediumtext int, creating 1 row each int, sort of reverse concat, guessing take large procedure
edit:reformulated question name
you should normalize table, concated ids stored in separate table, 1 id per record. in mean time, can use mysql's find_in_set() function:
select ... find_in_set(table_country.country_id, concatenated_ids) > 0 relevant docs: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set
Comments
Post a Comment