database - MySQL IN Clause in SQL query with User Defined Function -
i using following query update children of particular topic. update topics set reuse = 0 topic_id in (select getchildtopics(187)); where select getchildtopics(187); returns "188,190,189" update query updating first row topic_id = 188, instead of updating first topic only, should update 3 topics. when put values manually works fine. update topics set reuse = 0 topic_id in (188,190,189); can suggest what's wrong doing here? here code getchildtopics mysql function create definer=`root`@`localhost` function `getancestry`(givenid int) returns varchar(1024) charset latin1 deterministic begin declare rv varchar(1024); declare cm char(1); declare ch int; set rv = ''; set cm = ''; set ch = givenid; while ch > 0 select ifnull(parent_topic_id,-1) ch (select parent_topic_id topic_list id = ch) a; if ch > 0 set rv = concat(rv,cm,ch); set cm = ','; ...