我有一个名为' '的表的数据库。在此表中只有一列" item_details "拥有JSON格式的数据,如下所示: -
{
"book":[
{
"language":"English",
"author":["Y.Nikhilendra","Paresh Khairnar","Madhabendra Rout"]
},
{
"language":"English",
"author":["Sai Seetharam Nomula"]
}
],
"diary":[
{
"language":"Hindi",
"author":["Partha Banerjee"]
},
{
"laguage":"English",
"author":["Gaurav Pandey"]
}
]
}
我想根据 CodeIgniter 中的语言应用过滤器选项。 在控制器中
public function view()
{
$response = $this->view_model->viewModel( $language);
}
型号: -
public function viewModel($language)
{
$this->db->select(*);
$this->db->from('literature');
$this->db->where
//What would be structure of where clause?
}
答案 0 :(得分:0)
使用json_extract
WHERE(json_extract(json_each.value, '$.email') LIKE '%criteria%');
编辑:
如果您看到功能不存在,那么这个答案可能会对您有所帮助。 answer link