Reputation: 10417
I've following query to execute
SELECT m.*, s.momento_idmember, sd.id_send, d.momento_id
FROM `momento_send` s,
`send_distribution` sd,
`momento_distribution` d,
`momento` m
WHERE
s.momento_idmember=6 AND
sd.id_send=s.id AND
sd.id_distribution=d.id AND
d.momento_id=m.id;
MySQL 5.5.24 have proper relationship between tables.
Can someone please suggest how to achieve this query through Criteria (or whatever best for that) in propel. I'm trying it since 2+ hours without success.
Upvotes: 0
Views: 1446
Reputation: 22756
I will go onto something like this:
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn(MomentoSendPeer::MOMENTO_IDMEMBER);
$c->addSelectColumn(SendDistributionPeer::ID_SEND);
$c->addSelectColumn(MomentoDistributionPeer::MOMENTO_ID);
$c->addJoin(SendDistributionPeer::ID_SEND, MomentoSendPeer::ID, Criteria::INNER_JOIN);
$c->addJoin(SendDistributionPeer::ID_DISTRIBUTION, MomentoDistributionPeer::ID, Criteria::INNER_JOIN);
$c->addJoin(MomentoDistributionPeer::MOMENTO_ID, MomentoPeer::ID, Criteria::INNER_JOIN);
$c->add(MomentoSendPeer::MOMENTO_IDMEMBER, 6);
I don't think you can select m.*
using propel 1.4. So you will have to add all field manually.
Upvotes: 1