I understand. May be you (as Pro.) can help to optimize a bit this query? [code]SELECT article.id as id,
 article.name as name,
 article.description,
 article.image as a_image,
 article.url as a_url,
 article.stock,
 article.stock_warn,
 article.auto_def,
 MAX(article_owner.rs_user_id = 1) as is_owner,
 MAX(article_owner.rs_user_id = 1 AND article_owner.is_creator = 1) as is_creator,
 booking.count as b_count,
 booking.project_id,
 IFNULL(booking_extra.price_valued_damage, 0) - (SELECT
 SUM(booking.price_damage)
 FROM booking
 WHERE (booking.project_id = project.id
 AND booking.article_id = article.id)
 ) as rest_a_damage,
 booking_extra.price_valued_damage as a_damage,
 booking_extra.retour_sum as a_retour,
 booking_extra.date_count_changed as date_changed,
 booking.tip as b_tip,
 booking.tip_retour as b_tip_retour,
 IF(booking_extra.retour_sum IS NULL, booking_extra.state_warn, 0) as b_warn,
 article_group.id as g_id,
 article_group.name as g_name,
 article_section.id as s_id,
 article_section.name as s_name,
 article_user_option.favo IS NULL as is_favo,
 Â
 /* calc auto-retour booking */
 IF((booking_extra.retour_sum IS NULL OR booking_extra.retour_sum = ''),
 ROUND(booking_extra.count_sum - (booking_extra.count_sum / 100 * article.auto_def)),
 NULL) as calc_auto_def,
 Â
 /* subselect aviablility */
 (SELECT
 article.stock - (
 /* sub projects before and same day */
 SUM(
 IF (project.date_start <= '2008-09-22 00:00:00' ,
 booking_extra.count_sum,
 0)
 )
 -
 SUM(
 /* if retour before day */
 IF( (project.date_end < '2008-09-22 00:00:00' AND project.date_end IS NOT NULL),
 ROUND(booking_extra.count_sum - (booking_extra.count_sum / 100 * article.auto_def)),
 0
 )
 )
 )
 Â
 FROM booking_extra
 Â
 LEFT JOIN project
 ON (booking_extra.project_id = project.id)
 Â
 WHERE (booking_extra.article_id = article.id /* JOIN to parent query */
 AND booking_extra.retour_sum IS NULL) /* only not checked out */
 Â
 GROUP BY article.id
 LIMIT 1
 ) as count_aviability
 Â
 Â
 FROM article
 Â
 LEFT JOIN article_group
 ON (article.article_group_id = article_group.id)
 Â
 LEFT JOIN article_section
 ON (article_section.id = article_group.article_section_id)
 Â
 LEFT JOIN article_owner
 ON (article_owner.article_id = article.id
 AND article_owner.rs_user_id = 1)
 Â
 LEFT JOIN booking
 ON (booking.article_id = article.id
 AND booking.project_id = 2
 AND booking.client_id = 2 )
 Â
 LEFT JOIN booking_extra
 ON (booking_extra.article_id = article.id
 AND booking_extra.project_id = 2)
 Â
 LEFT JOIN article_user_option
 ON (article_user_option.article_id = article.id
 AND article_user_option.rs_user_id = 1)
 Â
 LEFT JOIN project
 ON (project.id = booking_extra.project_id)
 Â
 WHERE booking_extra.project_id = 2 AND article.deleted != 1 AND article_section.article_section_branch_id = 1
 Â
 Â
 GROUP BY article.id
 ORDER BY article_section.name, article_group.name, article.name;[/code]
It is a query from this Project: https://sourceforge.net/projects/openrentstock/