我想通过从项目行的引号中选择特定文本来获取其他行的值
图片:
我尝试了所有我知道的方法,但没有一个起作用......示例
$this->f3->get('DB')->exec('select tops.id, tops.name, tops.img from tops where tops.items = 1 ');
所以我想要从项目行中选择“1”或“2”(检查图像)
最佳答案
如果图像中显示的行是您尝试选择的行的示例,那么您应该使用的 SQL 字符串将是:
'select tops.id, tops.name, tops.img from tops where (tops.items like \'%"1":%\' or tops.items like \'%"2":%\');'
这将选择 tops.items 列包含 "1": 或 "2": 的行。如果您想匹配其他内容,请尝试将您的问题说得更清楚一些。
关于php - 如何从 SQL 中的引号中选择特定文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57218016/