我想做这样的事情:
SELECT a.*, (SELECT COUNT(*) FROM b where b.col1 = a.col2) as count FROM a
是否可以使用推进标准?
答案 0 :(得分:2)
$c = new Criteria();
$c->addSelectColumn(aPeer::TABLE_NAME.'.*');
$c->addAsColumn('count', '(SELECT COUNT(*) FROM b WHERE b.col1 = a.col2)');
aPeer::doSelect($c);