本文整理汇总了PHP中Am_Query::addUnion方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Query::addUnion方法的具体用法?PHP Am_Query::addUnion怎么用?PHP Am_Query::addUnion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Query
的用法示例。
在下文中一共展示了Am_Query::addUnion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAdapter
protected function createAdapter()
{
$q = new Am_Query(new CcRebillTable());
$q->clearFields();
$q->groupBy('rebill_date');
$q->addField('rebill_date');
$q->addField('(1)', 'is_log');
$q->addField('COUNT(t.rebill_date)', 'total');
$q->addField('SUM(IF(t.status=0, 1, 0))', 'status_0');
$q->addField('SUM(IF(t.status=1, 1, 0))', 'status_1');
$q->addField('SUM(IF(t.status=2, 1, 0))', 'status_2');
$q->addField('SUM(IF(t.status=3, 1, 0))', 'status_3');
$q->addField('SUM(IF(t.status=4, 1, 0))', 'status_4');
$u = new Am_Query(new InvoiceTable(), 'i');
$u->addWhere('i.paysys_id IN (?a)', $this->getPlugins());
$u->groupBy('rebill_date');
$u->clearFields()->addField('i.rebill_date');
$u->addField('(0)', 'is_log');
$u->addField('COUNT(i.invoice_id)', 'total');
for ($i = 1; $i < 6; $i++) {
$u->addField('(NULL)');
}
$u->leftJoin('?_cc_rebill', 't', 't.rebill_date=i.rebill_date');
$u->addWhere('i.rebill_date IS NOT NULL');
$u->addWhere('t.rebill_date IS NULL');
$q->addUnion($u);
$q->addOrder('rebill_date', true);
return $q;
}