dozr13344
2017-11-13 06:37
浏览 55
已采纳

特别是从mysql数据库中获取逗号分隔值

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 ?

图片转代码服务由CSDN问答提供 功能建议

我有一个数据库,其中有一个列,其中以逗号分隔的方式保存多个ID。 那些ID是在其他表中定义的。 我正在获取但是我得到的结果是单值(没有逗号)

我需要从另一个表和show中获取所有的id值。

是否可以在mysql查询中使用?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongye8110 2017-11-13 07:35
    已采纳

    Get first all id's,by column, and then explode it by comma,

    $explode = explode(',',$array->column);
    

    then using foreach pass the value to another table to get the row,

     foreach($explode as $single){
      // pass single id to query using where condition you can get row of that id.
     }
    

    or you can also use subquery, do google am sure stack overflow gives better result.

    点赞 打赏 评论

相关推荐 更多相似问题