Kendi cache sistemime geçiş için bir kereliğine lazımdı mysql de uğraşmak yerine dün gelen verilerde filtreleme yaptım aşağıdaki gibi, birine sıkıştığında mantık verebilir niyetiyle paylaşıyorum.
Sorunsalı
PHP olarak çözdük.
$kat_tmp_max= 10;
$kat_temp = array();
while($s = mysql_fetch_assoc($sorgu))
{
$kat_temp[] = $s['kategori_id'];
$kat_temp_kac = array_count_values($kat_temp);
if($kat_temp_kac[$s['kategori_id']]<=$kat_tmp_max)
{
$sx[count($sx)] = $s;
}
}
unset($kat_temp);
unset($kat_temp_kac);