sql - 如何将 Magento sql 查询显示为字符串?

标签 sql database string magento

Magento 构造它的 SQL 查询如下

 $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    )

有没有办法以字符串格式显示结果查询而不是打印出巨大的对象,例如

echo $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    )->toString();

最佳答案

$select = $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    );

echo $select;

关于sql - 如何将 Magento sql 查询显示为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4680116/

相关文章:

mysql - 如何使用mysql join更新记录?

sql - 构建 mysql 查询时出现问题(每项最新)

sql-server - 日期之间和基于员工姓名的 SQL 查询

sql - cassandra:单行可变列数

c++ - 将字符串值转换为标准字符串

java - java中如何从字符串中去掉字符串?

sql - chalice 3 : using findAll with join tables

sql - 使用嵌套选择混淆性能增益 * 不存在

ruby-on-rails - ruby rails : How to set a database timeout in application configuration?

android - 如何仅在字符串中的整数之间放置空格