Mysql query WHERE column is in json array

后端 未结 3 1727
[愿得一人]
[愿得一人] 2021-01-12 14:28

I have setup an query where it selects multiple things.

$stm = $db->query(\'SELECT startUser, forUser, percentage, time, taskTitle, taskDesc, color FROM a         


        
3条回答
  •  孤城傲影
    2021-01-12 15:18

    If it truly is a JSON field, in 5.7 you can do this:

    SELECT
      startUser,
      forUser,
      percentage,
      time,
      taskTitle,
      taskDesc,
      color
    FROM admin_task
    WHERE JSON_CONTAINS(forUser->'$[*]', JSON_ARRAY("somestring"))
    

提交回复
热议问题