tags:

views:

312

answers:

1

I am writing a query using the Propel ORM

The query is of the form:

select * from some_table where some_table.created_at = (SELECT MAX(some_table.created_at) from some_table);

I got this far:

 $c = new Criteria();
 $c->addSelectColumn('MAX('.self::CREATED_AT.')');

Anyone knows how to use Propel to do this, to save me writing RAW SQL?

+1  A: 

Try:

$c = new Criteria();
$c->add(SomeTable::CREATED_AT, '(SELECT MAX('.SomeTable::CREATED_AT.') FROM some_table)', Criteria::CUSTOM);
prodigitalson