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 = 43 
  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 = 43

Query time 0.00063

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
43 en <p><b>RETURNS AND EXCHANGES</b></p><p>Customer satisfaction is of the utmost importance to us and we want you to love and enjoy your Anara Skincare products.</p> <p>If you have any questions or concerns, please email hello@anaraskincare.com and we will be happy to assist.</p> <p><b>­­­­­­­­­­­­­­­­­­­­­­­YOUR RIGHT TO RETURN AN ITEM</b></p> <p>We have a 14-day return policy on anything purchased via www.anaraskincare.com. This means you have 14 days from the date your order was delivered to you to request a return. To be eligible for a return your item must be in the same condition that you received it, unopened, unused and fit for resale.&nbsp;</p> <p>To start a return, you should contact us at hello@anaraskincare.com, stating your order number and details of the items you wish to return. If you are eligible for a return, we will send you instructions of where to send your returned products. Items sent back to us without first contacting us via the email address given above will not be accepted.&nbsp;</p> <p>We are unable to take responsibility for delivery costs and lost items. Please ensure all returned items are sent with a trackable, insured service that provide you with proof of postage. We cannot take responsibility for any items lost or damaged in transit. Delivery costs are non-refundable.</p> <p><b>FAULTY ITEMS</b></p> <p>If the item you have received is defective, damaged or if you have been sent the incorrect item, you must notify us immediately after receiving your order.</p> <p>Email hello@anaraskincare.com<a href="mailto:hello@anaraskincare.com">&nbsp;</a>and provide your order number and details of the issue with images where applicable, so that we can resolve the issue quickly for you.</p> <p>We may ask for the faulty item to be returned to us before issuing a refund or replacement.</p> <p>If after inspection the items are deemed to be defective or faulty we will process a full refund for the price paid for the items.</p> <p><b>CONCERNS WITH A PRODUCT</b></p> <p>If you have any concerns or queries regarding a product please contact us by emailing&nbsp;<a href="mailto:hello@anaraskincare.com">hello@anaraskincare.com</a>.</p> <p>Please note that full ingredient lists are available on our website and also on the retail packaging of all of our products.</p> <p>It is your responsibility to read this information carefully, as even with gentle, natural origin ingredients, there could be circumstances where you may be allergic to an ingredient and a reaction could occur.</p> <p><b>REFUND PROCESS</b></p> <p>On receipt of the items and after inspection we will contact you to advise if a refund was approved or not. If approved, we will refund the price you paid for the item back to your original payment method within 7 days.</p> <p>Please note that different banks have different processing times so it may take longer for the refund to appear in your bank account or on your credit card statements.</p><p><br></p><p>For more information and FAQ's - please visit&nbsp;<a href="https://www.anaraskincare.com/pages/contact">https://www.anaraskincare.com/...</a></p> Anara Skincare A Anara Skincare hello@anaraskincare.com none Y 1752815663 38 0 a:4:{s:14:"company_fields";a:6:{i:37;s:5:"Arati";i:38;s:3:"Nar";i:53;s:442:"We offer a luxurious, natural-origin skincare capsule designed to support your skin through all of life’s sensitivities: from hormonal changes and emotional stress to pregnancy, menopause, and beyond. Every product is multi-use for eyes, face and neck and thoughtfully formulated to simplify your routine without compromising on results. This is skincare that meets you where you are, grounding, effective, and effortless to use, every day.";i:54;s:423:"Our range includes five multi-use, natural-origin skincare products and a beauty tool - designed to be a capsule wardrobe for your skin. Each one is designed to be used on the face, neck, and around the eyes, individually or as part of a simple, high-performing routine. We’d love to collaborate on gifting and wellbeing-focused sets using our core range - ideal for customers looking for purposeful, luxurious self-care.";i:55;s:454:"Our customers are intelligent, discerning women navigating the sensitivities of real life, through pregnancy, menopause, and everything in between. Often caring for others before themselves, they crave a quiet moment in the rush hour of life. They seek products that truly understand them and meet them where they are. They value simplicity, high performance, and quiet luxury, choosing skincare that respects their time, their skin, and their standards.";i:56;s:52:"We currently deliver in England, Scotland and Wales.";}s:15:"admin_firstname";s:5:"Arati";s:14:"admin_lastname";s:3:"Nar";s:6:"fields";a:0:{}} 336015529 1 10 N N N 0 0 0 0 N 0 acct_1S7x0CFDtxXZl0h6 S Launch - 20% anara-skincare 43_0