我刚刚开始使用Propel
. 我有一种情况,我将一个表加入到自身中以获得一个最小值。我编写的查询可以按我的需要工作,但我不知道如何使用Propel
模型来完成它。
此查询获取在给定日期之后注册的每个用户进行的第一次成功付款:
SELECT `p`.`id` AS `payment_id`,
`p`.`request_date`,
`u`.`id` AS `user_id`,
`u`.`registration_date`
FROM `payments` AS `p`
LEFT JOIN `payments` AS `filter`
ON `p`.`user_id` = `filter`.`user_id`
AND `p`.`id` > `filter`.`id`
INNER JOIN `users` AS `u`
ON `p`.`user_id` = `u`.`id`
AND `u`.`registration_date` >= '2013-07-28'
WHERE `p`.`completed` = 1
AND `filter`.`id` IS NULL
ORDER BY `u`.`registration_date` DESC
请帮我把它翻译成Propel
代码。