[RSS Feed/News] how to group and count?

Status
Not open for further replies.

XenForo

Administrative
  • Thread starter
  • Admin
  • #1
table

id1|id2 with unique(id1-id2)
1 | 2
1 | 3
1 | 4
2 | 2
2 | 5
2 | 6
3 | 7

i have an array with id1s
i could, but dont want:

foreach arrayId1 as $key
{
$result => $repo->find id1/id2 where id1=$key
$result->count()

=> count(arrayid1) queries?

instead i can try
$result => $repo->find id1/id2 where id1 in $array{id1} ->group by id1

foreach $result as $key
{
$counter{$key} = $result->count()

better way and 1 query?

ادامه مطلب...
 
Status
Not open for further replies.
Back
Top Bottom