I have database where i have a column where multiple ids are saved in comma separated way. That ids are defined some other table . I am fetching the but i am getting result where there is single value (no comma)
i need all all the ids value fetched there definition from another table and show.
Is it possible in mysql query ?
答案 0 :(得分:2)
按列列出所有ID,然后用逗号
对其进行爆炸$explode = explode(',',$array->column);
然后使用foreach将值传递给另一个表以获取行
foreach($explode as $single){
// pass single id to query using where condition you can get row of that id.
}
或者您也可以使用子查询,google确保堆栈溢出可以提供更好的结果。