加入查询Symfony 1.4.11/Propel 1.4.2


Join query Symfony 1.4.11/Propel 1.4.2

我有以下查询来执行

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表与表之间有适当的关系。

有人能建议如何通过推进中的条件(或任何最适合的条件)来实现这个查询吗。我试了2个多小时都没有成功。

我将讨论以下内容:

$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);

我认为您无法使用推进1.4选择m.*。因此,您必须手动添加所有字段。