Reputation: 3
I want to do something like this:
SELECT a.*, (SELECT COUNT(*) FROM b where b.col1 = a.col2) as count FROM a
is it possible using propel criteria or not?
Upvotes: 0
Views: 1861
Reputation: 5827
$c = new Criteria();
$c->addSelectColumn(aPeer::TABLE_NAME.'.*');
$c->addAsColumn('count', '(SELECT COUNT(*) FROM b WHERE b.col1 = a.col2)');
aPeer::doSelect($c);
Upvotes: 2