我怎样才能从我的兑换表中取回一个“计数”,基于激励ID 和收件人ID 并将其添加到以下查询中。
SELECT recipient.*, incentive.*
FROM recipient
INNER JOIN incentive ON recipient.incentiveID=incentive.incentiveID
WHERE recipient.mobile = :mobile
AND recipient.incentiveID = :incentiveID"
下面的查询带回收件人和激励数据。我想扩展它并“计算”收件人兑换了多少次。即兑换计数
兑换表 看起来像这样,并通过激励ID ,收件人ID 链接
RedeemedID incentiveID recipientID timestamp