代码点火器 db->where_in 添加



我在where_in上遇到了问题。我正在尝试获取拥有外观手册具有特定点ID的商店名称

$this->db->select('shop');
$this->db->from('shopify_lookbook');
$this->db->where_in('lookbook_id', 'SELECT lookbook_id FROM shopify_point WHERE point_id = $pointid');

问题是它生成的查询

SELECT `shop` FROM `shopify_lookbook` WHERE `lookbook_id` IN('SELECT lookbook_id FROM shopify_point WHERE point_id = 543') 

它会给出空白,但是当我在 mysql 中尝试时,IN()中没有">

,如下所示
SELECT `shop` FROM `shopify_lookbook` WHERE `lookbook_id` IN(SELECT lookbook_id FROM shopify_point WHERE point_id = 543)

它返回我想要的商店名称。如何擦除''$this->db->where_in()

你可以改用where,并在那里构造你的IN子句:

$this->db->where('lookbook_id IN (SELECT lookbook_id FROM shopify_point WHERE point_id = $pointid)', NULL, FALSE);

相关内容

  • 没有找到相关文章

最新更新