How does the following SQL query look like in Propel (1.4)?
SELECT SUM(`price_equipment`) FROM `order_equipment` WHERE `order_id` = 57072;
I did some research using google but all examples I found take into count GROUP BY clause. I just need a single value.
I think the syntax for Propel 1.4 would be something like:
$c = new Criteria();
$c->add(OrderEquipmentPeer::ORDER_ID, $orderId);
TestPeer::addSelectColumns($c);
$c->addAsColumn('price_sum', 'SUM('.OrderEquipmentPeer::PRICE_EQUIPMENT.')');
$results = OrderEquipmentPeer::doSelectStmt($c);
It's really hard to find documentation from 1.4 as they have killed the old wiki on propelorm.org, but I think that's right. As I said in my other comment though, you should consider upgrading to Propel 1.6 as it has a LOT more features and much better stability. The 1.4 branch is not being maintained at all as far as I know.