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

Query time 0.00091

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
34 en <p><span style="font-size:24px;font-weight:700;">dot. Terms & Conditions (packages sold via We are The Helpful)</span></p> <p>These terms and conditions constitute a legally binding agreement between the Client and Professional Organiser/s. Before agreeing to the content of these Terms and Conditions, please check that you understand and agree with everything because when you have agreed, this becomes legally binding and you agree to abide fully by these Terms and Conditions.</p> <p>If you need the contract read to you or provided in large print format please ensure you ask. If there is anything you do not understand, please ask for more information.</p> <p>All references to ‘vouchers’ refer solely to the ‘Nest’ and ‘Head & Headspace’ services; exclusively available to purchase as part of a partnership between Decant.Organise.Time Limited and We are The Helpful.</p> <h3>Payments & Charges</h3> <ol> <li> <p>Vouchers must be used in full in one transaction. No change given.</p> </li> <li> <p>Vouchers are non-refundable and non-transferable. No cash alternative.</p> </li> <li> <p>Vouchers valid for 12 months from purchase date (expiry stated on e-voucher).</p> </li> <li> <p>Additional vouchers cannot extend expiry.</p> </li> <li> <p>Vouchers purchased via wearethehelpful.com can’t be used with other services.</p> </li> <li> <p>Vouchers can't be used to pay for storage products.</p> </li> <li> <p>Vouchers are not cheque guarantee, credit or charge cards.</p> </li> <li> <p>Decant.Organise.Time Limited may refuse suspicious or illegally obtained vouchers.</p> </li> <li> <p>Vouchers are verified at use; tampered/damaged vouchers may be refused.</p> </li> <li> <p>All vouchers are non-refundable and must be purchased via the secure website.</p> </li> <li> <p>Payments must be via the secure system; company not VAT registered.</p> </li> <li> <p>Rates may change, but booked services at old rates are honoured.</p> </li> <li> <p>Terms may be amended without notice.</p> </li> <li> <p>Storage items bought during service must be paid in full that day. Returns must be unused, undamaged, and in original condition.</p> </li> <li> <p>Credit notes are valid for 12 months.</p> </li> <li> <p>Return shipping/collection costs are the client’s responsibility.</p> </li> <li> <p>No credit note if returned items are used/damaged or improperly packaged.</p> </li> </ol> <h3>Cancellations</h3> <ol> <li> <p>Rescheduling must occur within 2 months of original date.</p> </li> <li> <p>Same-day cancellations incur travel fees.</p> </li> <li> <p>Cancellations 2+ days before booking will be rebooked at no cost.</p> </li> <li> <p>Rescheduling will be attempted within 6 weeks.</p> </li> <li> <p>All reschedules/cancellations must complete within 2 months of original date.</p> </li> <li> <p>Cancellations must be in writing via email and confirmed in writing.</p> </li> <li> <p>Repeated cancellations may result in refusal of further service.</p> </li> </ol> <h3>Use of Vouchers</h3> <ol> <li> <p>A consultation is required at least 14 days before a booking unless otherwise agreed.</p> </li> <li> <p>Consultation outlines service and plan; additional storage purchases must be separate.</p> </li> <li> <p>Vouchers are only sold via wearethehelpful.com.</p> </li> <li> <p>You’ll receive an e-voucher with a Unique Client Pin and booking instructions.</p> </li> <li> <p>These terms apply to both purchase and use of vouchers.</p> </li> <li> <p>Services have fixed durations and will not exceed them.</p> </li> </ol> <h3>Services & Works</h3> <ol> <li> <p>All services are confidential.</p> </li> <li> <p>Staff sign confidentiality agreements; privacy governed by policy.</p> </li> <li> <p>Personal data used solely for services.</p> </li> <li> <p>An initial consultation is required.</p> </li> <li> <p>Breaks during the session are allowed but count towards total service time.</p> </li> <li> <p>Organisers may take their own rest break outside of client hours.</p> </li> <li> <p>Bookings start at 9am Mon–Fri unless agreed otherwise; weekends/bank holidays may cost extra.</p> </li> <li> <p>Ensure clear access on the day.</p> </li> <li> <p>Furniture will only be moved if discussed. Unsafe situations may prevent movement.</p> </li> <li> <p>Unsafe working areas may result in booking cancellation.</p> </li> <li> <p>Client is responsible for deciding what to keep/discard.</p> </li> <li> <p>Client may recycle/donate/sell items, but no valuations are provided.</p> </li> <li> <p>Organisers do not remove waste or donation items.</p> </li> <li> <p>Photos may be taken and are company property.</p> </li> <li> <p>Photos may be used for marketing only with anonymisation or consent.</p> </li> <li> <p>Recommendations of third-party products are not company liability.</p> </li> <li> <p>Small items may be assembled; large items should be pre-assembled.</p> </li> <li> <p>This is not a cleaning service, but reasonable effort is made.</p> </li> <li> <p>Company holds Public Liability and Professional Indemnity Insurance.</p> </li> <li> <p>Agreement to terms is required before booking.</p> </li> <li> <p>Company not liable for damages; clients should insure possessions.</p> </li> <li> <p>If service is interrupted, hours will be made up later.</p> </li> <li> <p>Booking may be terminated for:</p> </li> </ol> <ul> <li> <p>Threatening behavior</p> </li> <li> <p>Theft</p> </li> <li> <p>Attacks on staff</p> </li> <li> <p>Breach of terms</p> </li> </ul> <ol> <li> <p>Bookings are address-specific. A new address may invalidate service.</p> </li> <li> <p>In the event of national lockdown, services will cease. Refunds at director’s discretion.</p> </li> <li> <p>Updates to terms will be listed on the website.</p></li></ol> dot. Professional Organisers (Decant.Organise.Time Limited) A dot. Professional Organisers (Decant.Organise.Time Limited) decant.organise.time@gmail.com +447855033216 none Y 1741177629 0 a:4:{s:14:"company_fields";a:6:{i:37;s:5:"Katie";i:38;s:9:"L'Aimable";i:53;s:27:"Lead Professional Organiser";i:54;s:93:"Home Organising Services / House move Unpacking Services / Pre & Post Baby Organising Package";i:55;s:116:"age range typically 25 - 45 women/mothers/families overwhelmed / lack of time / in need of systems and structure";i:56;s:2:"UK";}s:15:"admin_firstname";s:5:"Katie";s:14:"admin_lastname";s:9:"L'Aimable";s:6:"fields";a:0:{}} 1 9 N N N 0 0 0 0 N 0 acct_1R7EIeJoqHai7DjG S Launch - 15% dot-professional-organisers-decant-organise-time-limited 34_0