sorry, but i don't understand your query,i don't see where is limit number, where is inner join
more what i need
What is the best way to limit for each id in one query?
I have five threads, fromthere i get five ids ($tids) there are not the same,
one time there are 1,2,3,4,5 next 2,3,4,5,6, there are changing, i get latest threads
i need latest posts for threads
the $tids in array
i need to get 5 or oder number (limit) posts to each thread
exemple, lests say for exemple threads have that ids 1,2,3,4,5
> row one = have thread id 1 and gets posts 1,2,,3,4,5
> row two = have thread id 1 and gets posts 6,7,8,9,10
> row three = have thread id 1 and gets posts 11,12,13,14,15
> row four = have thread id 1 and gets posts 16,17,18,19,20
> row five = have thread id 1 and gets posts 21,22,23,24,25
$tids = join("','",array_keys($threads));
$query = $db->query("
SELECT *
FROM ".TABLE_PREFIX."posts sc
INNER JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)
WHERE 1=1 AND p.tid IN ('".$tids."')
ORDER BY p.dateline ASC");
i need something like this in onme query
$tids = array_keys($threads);
foreach($tids as $k => $v)
{
$query = $db->query("
SELECT *
FROM ".TABLE_PREFIX."posts sc
INNER JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)
WHERE 1=1 AND p.tid = ".$v."
ORDER BY p.dateline ASC
LIMIT 5");
}