I have a recursive table and I want to be able to limit results for pagination..
what I did first was:
SELECT * FROM rvus WHERE scat_id =$scat_id AND cat_id=$cat_id AND tied_id=0
(the 0 for "tied_id" gave me parent results)
then I'd do a nested query :
SELECT * FROM rvus WHERE scat_id =$scat_id AND cat_id=$cat_id AND tied_id=parent ID
(for the child results)
but I dont know how to do a limit 0,10 on those two combined...
and this combined query:
$result = mysql_query("SELECT * FROM rvus WHERE scat_id =$scat_id AND cat_id=$cat_id ORDER BY heading LIMIT 0,10 ", $db)
returns the results but strictly in alpha order
I want a parent then its children, next parent then its children etc
the db has the column "tied_id" where parents = 0 and children will all have the parent id
(table doesnt recurse more than one level)
any ideas appreciated - use CASE somehow??