且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将相关数据计数添加到joomla MVC列表视图中的每个项目

更新时间:2022-11-19 19:00:52

您应该明确地加入,但据我了解,您想要的是出价计数?在这种情况下,您应该进行分组查询,类似于ilias所说的,但是:

you should definently make a join, but from what I understand what you want is the bid-count? In that case you should make a group-by query, similar to what ilias is saying, but:

$query->select('count(itemBids.bids) AS bidsNum');
$query->join('LEFT', '#__entrusters_bids AS itemBids ON itemBids.item_id = a.id');
$query->group('a.id'); 

还要注意联接中on语句中的引用更改,

also notice to the reference change in the on-statement in the join,

向乔纳斯致敬