SELECT 
  company_descriptions.*, 
  companies.*, 
  cscart_vendor_plan_descriptions.plan, 
  cscart_seo_names.name as seo_name, 
  cscart_seo_names.path as seo_path, 
  AVG(
    cscart_discussion_rating.rating_value
  ) AS average_rating, 
  CONCAT(
    companies.company_id, 
    '_', 
    IF (
      cscart_discussion_rating.thread_id, 
      cscart_discussion_rating.thread_id, 
      '0'
    )
  ) AS company_thread_ids 
FROM 
  cscart_companies AS companies 
  LEFT JOIN cscart_company_descriptions AS company_descriptions ON company_descriptions.company_id = companies.company_id 
  AND company_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_vendor_plan_descriptions ON companies.plan_id = cscart_vendor_plan_descriptions.plan_id 
  AND cscart_vendor_plan_descriptions.lang_code = 'en' 
  LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = 36 
  AND cscart_seo_names.type = 'm' 
  AND cscart_seo_names.dispatch = '' 
  AND cscart_seo_names.lang_code = 'en' 
  LEFT JOIN cscart_discussion ON cscart_discussion.object_id = companies.company_id 
  AND cscart_discussion.object_type = 'M' 
  LEFT JOIN cscart_discussion_posts ON cscart_discussion_posts.thread_id = cscart_discussion.thread_id 
  AND cscart_discussion_posts.status = 'A' 
  LEFT JOIN cscart_discussion_rating ON cscart_discussion.thread_id = cscart_discussion_rating.thread_id 
  AND cscart_discussion_rating.post_id = cscart_discussion_posts.post_id 
WHERE 
  companies.company_id = 36

Query time 0.00667

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.10"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "companies",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "company_id"
          ],
          "key_length": "4",
          "ref": [
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "6K"
          },
          "used_columns": [
            "company_id",
            "status",
            "company",
            "lang_code",
            "address",
            "city",
            "state",
            "country",
            "zipcode",
            "email",
            "phone",
            "url",
            "storefront",
            "secure_storefront",
            "entry_page",
            "redirect_customer",
            "countries_list",
            "timestamp",
            "shippings",
            "logos",
            "request_user_id",
            "request_account_name",
            "request_account_data",
            "tax_number",
            "registered_from_storefront_id",
            "plan_id",
            "pre_moderation",
            "pre_moderation_edit",
            "pre_moderation_edit_vendors",
            "suspend_date",
            "grace_period_start",
            "last_time_suspended",
            "last_debt_notification_time",
            "override_delivery_days",
            "delivery_days",
            "stripe_connect_account_id",
            "stripe_connect_account_type",
            "paypal_commerce_platform_account_id"
          ]
        }
      },
      {
        "table": {
          "table_name": "company_descriptions",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "company_id",
            "lang_code"
          ],
          "key_length": "10",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "company_id",
            "lang_code",
            "company_description",
            "terms",
            "i18n_company",
            "i18n_address",
            "i18n_city"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_vendor_plan_descriptions",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "plan_id",
            "lang_code"
          ],
          "key_length": "10",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "792"
          },
          "used_columns": [
            "plan_id",
            "lang_code",
            "plan"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_seo_names",
          "access_type": "ref",
          "possible_keys": [
            "PRIMARY",
            "dispatch"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "object_id",
            "type",
            "dispatch",
            "lang_code"
          ],
          "key_length": "206",
          "ref": [
            "const",
            "const",
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.25",
            "eval_cost": "0.10",
            "prefix_cost": "0.35",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "name",
            "object_id",
            "type",
            "dispatch",
            "path",
            "lang_code"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_discussion",
          "access_type": "const",
          "possible_keys": [
            "object_id"
          ],
          "key": "object_id",
          "used_key_parts": [
            "object_id",
            "object_type"
          ],
          "key_length": "6",
          "ref": [
            "const",
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.25",
            "eval_cost": "0.10",
            "prefix_cost": "0.70",
            "data_read_per_join": "24"
          },
          "used_columns": [
            "thread_id",
            "object_id",
            "object_type"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_discussion_posts",
          "access_type": "ref",
          "possible_keys": [
            "thread_id",
            "thread_id_2"
          ],
          "key": "thread_id",
          "used_key_parts": [
            "thread_id"
          ],
          "key_length": "3",
          "ref": [
            "wearethehelpful_scalesta_net.cscart_discussion.thread_id"
          ],
          "rows_examined_per_scan": 2,
          "rows_produced_per_join": 2,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.50",
            "eval_cost": "0.20",
            "prefix_cost": "1.40",
            "data_read_per_join": "896"
          },
          "used_columns": [
            "post_id",
            "thread_id",
            "status"
          ],
          "attached_condition": "<if>(is_not_null_compl(cscart_discussion_posts), (`wearethehelpful_scalesta_net`.`cscart_discussion_posts`.`status` = 'A'), true)"
        }
      },
      {
        "table": {
          "table_name": "cscart_discussion_rating",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY",
            "thread_id"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "post_id"
          ],
          "key_length": "3",
          "ref": [
            "wearethehelpful_scalesta_net.cscart_discussion_posts.post_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 2,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.50",
            "eval_cost": "0.20",
            "prefix_cost": "2.10",
            "data_read_per_join": "32"
          },
          "used_columns": [
            "rating_value",
            "post_id",
            "thread_id"
          ],
          "attached_condition": "<if>(is_not_null_compl(cscart_discussion_rating), (`wearethehelpful_scalesta_net`.`cscart_discussion_rating`.`thread_id` = `wearethehelpful_scalesta_net`.`cscart_discussion`.`thread_id`), true)"
        }
      }
    ]
  }
}

Result

company_id lang_code company_description terms i18n_company i18n_address i18n_city status company address city state country zipcode email phone url storefront secure_storefront entry_page redirect_customer countries_list timestamp shippings logos request_user_id request_account_name request_account_data tax_number registered_from_storefront_id plan_id pre_moderation pre_moderation_edit pre_moderation_edit_vendors suspend_date grace_period_start last_time_suspended last_debt_notification_time override_delivery_days delivery_days stripe_connect_account_id stripe_connect_account_type paypal_commerce_platform_account_id plan seo_name seo_path average_rating company_thread_ids
36 en <p><br /></p> <h1>àile holistic Terms & Conditions for Sales via <i>We Are The Helpful</i></h1> <p><b>OVERVIEW</b></p> <p>These Terms & Conditions (“Terms”) govern your access to and use of the product and service offerings provided by àile holistic (“we”, “us”, “our”) as listed on the <i>We Are The Helpful</i> marketplace (“Marketplace”). By purchasing from our store through the Marketplace, you agree to be bound by these Terms, in addition to any Marketplace-wide policies and terms set by <i>We Are The Helpful</i>.</p> <p><i>We Are The Helpful</i> provides the platform that enables us to sell our goods and services to you, the customer. All transactions are facilitated by the Marketplace, while fulfilment and customer service related to our products are managed by us directly.</p> <h2>1. ONLINE SALES TERMS</h2> <p>By placing an order with us through the Marketplace, you confirm that:</p> <ul><li>You are at least the age of majority in your jurisdiction. </li><li>You will provide accurate and complete order and delivery information. </li><li>You are purchasing for personal use and not for resale. </li></ul> <p>You may not use our products or services for any unlawful or unauthorised purpose. Any violation of these Terms may result in cancellation of your order and/or restriction from future purchases.</p> <h2>2. PRODUCT INFORMATION AND AVAILABILITY</h2> <p>We make every effort to ensure that all product details, images, and pricing listed on the Marketplace are accurate. However:</p> <ul><li>Descriptions may not always be complete or current. </li><li>Colour representation may vary due to screen displays. </li><li>Availability is not guaranteed. We reserve the right to withdraw or amend products without prior notice. </li></ul> <p>All prices are in GBP (£) and inclusive of VAT unless otherwise stated.</p> <h2>3. ORDERS AND PAYMENT</h2> <p>Orders placed via the Marketplace are subject to acceptance and availability. We reserve the right to:</p> <ul><li>Refuse or cancel any order for any reason, including suspected fraud or stock unavailability. </li><li>Limit or restrict quantities purchased per customer, household, or address. </li></ul> <p>Payment is processed securely through the Marketplace platform. We do not collect or retain your payment information.</p> <h2>4. SHIPPING, RETURNS AND REFUNDS</h2> <p>Shipping details (costs, delivery windows, carriers used) are outlined on our Marketplace listings. By ordering, you agree to those terms.</p> <p>Returns, refunds or exchanges are subject to our [Returns Policy] as published on the Marketplace. All requests should be submitted via the Marketplace's customer support, unless otherwise directed.</p> <p>We are not responsible for any delays or damages caused during transit by third-party carriers.</p> <h2>5. CUSTOMER SUPPORT</h2> <p>We aim to provide thoughtful and timely customer service. If you have any concerns about your order, please contact us through the <i>We Are The Helpful</i> platform in the first instance.</p> <h2>6. THIRD-PARTY SERVICES</h2> <p>We may refer to or include third-party products or services within our offering. We are not responsible for the content, accuracy, or practices of any third-party sites or providers.</p> <h2>7. PRIVACY & DATA</h2> <p>Your personal information is collected by <i>We Are The Helpful</i> in accordance with their Privacy Policy. We do not receive or retain your payment data, but we may receive necessary order and delivery information to fulfil your order. We treat all such information as confidential and will not share it with external parties unless required for fulfilment or legally obligated.</p> <h2>8. LIMITATION OF LIABILITY</h2> <p>To the fullest extent permitted by law, we shall not be liable for any indirect, incidental, or consequential damages arising from your purchase or use of our products. This includes, but is not limited to, lost profits, business interruption, or personal injury.</p> <h2>9. INDEMNIFICATION</h2> <p>You agree to indemnify and hold us harmless from any claims, losses or damages, including legal fees, arising from your breach of these Terms or violation of any applicable law.</p> <h2>10. MODIFICATIONS</h2> <p>We reserve the right to update or change these Terms at any time. Updates will be reflected on our Marketplace store page, and your continued use of our offerings constitutes acceptance of the revised Terms.</p> <h2>11. GOVERNING LAW</h2> <p>These Terms are governed by and construed in accordance with the laws of England and Wales. Any disputes shall be subject to the exclusive jurisdiction of the courts of England and Wales.</p> <p><b>Contact</b> If you have any questions regarding these Terms, please contact us through the Marketplace platform or via email.</p> <p></p> àile - (aile holistic ltd) A àile - (aile holistic ltd) hello@aile-holistic.com +44 7725 985970 none Y 1744042295 32 0 a:4:{s:14:"company_fields";a:6:{i:37;s:4:"Gill";i:38;s:8:"McDonald";i:53;s:714:"I’m a holistic, intuitive therapist and wellness collaborator, offering a variety of sensory-led products and experiences — including bespoke scent compositions for individuals, brands, and special events. My work is shaped by my life experiences and a passion for helping others find balance, space, clarity, and healing. I offer treatments that weave together bodywork, energy practices, and natural aromatherapy, inviting people to slow down, reconnect with themselves, and create more intentional moments in their daily lives. All of our products are made with natural ingredients, with a focus on sustainability and authenticity, and are designed to help individuals feel grounded, nurtured, and balanced.";i:54;s:271:"Thoughtfully curated self-care bundles, bespoke aromatherapy blends, and holistic treatments. I’d also love to offer workshops and experiences that support emotional wellbeing and sensory connection — including custom scent creation, rituals, and self-care practices.";i:55;s:479:"Our customers are intuitive and thoughtful, often navigating transitions, seeking calm, or craving deeper relaxation and connection. They’re drawn to ritual, nature-based practices, and products made with intention. Many value the bespoke, personal nature of what we offer — appreciating support that feels deeply individual and aligned with where they are. Most are women who cherish emotional wellbeing, slow living, and the small sacred acts of caring for self and others.";i:56;s:461:"We are rooted in Scotland, with regular workshops and treatments in Edinburgh and private events held across the UK. We also collaborate on retreats both locally and abroad, and send our ritual-led products to customers around the world. Our signature range is used in treatments and stocked at a beautiful head spa in Tokyo which is such a wonderful reminder of how our products can find their place in spaces that value and prioritise intention and wellbeing.";}s:15:"admin_firstname";s:4:"Gill";s:14:"admin_lastname";s:8:"McDonald";s:6:"fields";a:0:{}} SC733466 - company number 1 10 N N N 0 0 0 0 N 0 acct_1RNx39FMcLUvBs1r S Launch - 20% aile-aile-holistic-ltd 36_0