mysql - Magento - 使用存储过程数组结果集作为集合

标签 mysql magento

我在我的 magento 数据库中编写了一个 mysql 存储过程来执行复杂的操作,并想在我的 magento 代码中使用它们。我能够从我的 magento 代码中调用该过程并在数组中获取结果集。现在我想使用这个结果集作为模型来使用 joinattribute 进行进一步的连接,或者更具体地说,我想将这个输出结果集从存储过程传输到一个集合中,以便我可以使用 getcollection 方法。我该怎么做?

最佳答案

来自thread on joining procedure results :

> Is it possible to join a table on the results from a stored procedure within a single query?

No.

所以看起来你必须做很长的路要走,并使用数组作为参数。

// $collection is a collection
// $results is the stored procedure results as an array
$collection->addAttributeToFilter('ATTRIBUTE_NAME', array('in'=>$results));

有关集合的类似技巧,请参阅“其他比较运算符”here .

关于mysql - Magento - 使用存储过程数组结果集作为集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6894537/

相关文章:

MySQL 查询关联星期几和发送消息的小时

mysql - 默认Pod上的MySQL ram使用情况

php - Magento install 在可用时提示缺少 InnoDB

Magento - 保存产品而不设置 "Use Default Value"

php - magento paypal 收到错误 :We're sorry, PayPal 不允许美国居民将购买的商品运送到英国

mysql - 如何使用AWK脚本在mysql表中插入圆括号?

php读取mysql位域返回奇怪的字符

php - 搜索已登录用户的名称

html - 使用CSS以全宽显示表格

mysql - Magento SQLSTATE[42S01] 错误