Hi, I have tried the following query and it works fine. It takes 11 seconds and this is a little too much, but this is another issue.
The problem is that if I delete the following condition from it: a.id_categories=31 The query gives the following error: ERROR 1032 (HY000): Can't find record in '' What can I do to make it work? Thank you. select straight_join sql_calc_found_rows a.hash, a.pre_title, a.title, a.post_title, substring(a.body, 1, 250) as preview, a.hash, a.date, a.time, length(a.body) as size, a.id_categories, n.name as newspaper, sc.category, count(act.id) as visitors, count(aco.hash) as comments from articles a inner join newspapers n on(a.id_newspapers=n.id) inner join sections s on(a.id_sections=s.id and n.id=s.id_newspapers) inner join sections_categories sc on(a.id_categories=sc.id) left join articles_count act on(a.hash=act.hash_articles) left join articles_comments aco on(a.hash=aco.hash_articles) where a.id_categories=31 and a.date between '2005-01-01' and '2005-12-31' and a.active_view=1 group by a.hash order by visitors limit 0,30; Teddy -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]