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

Query time 0.00174

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
22 en <p>TERMS AND CONDITIONS<br>Grow + Gather - TERMS AND CONDITIONS OF BOOKING<br>This page sets out the terms and conditions for booking our courses and sessions<br>(the “Terms”).&nbsp; Within these Terms “Grow + Gather”, “we” or “us” or “our”<br>means Grow + Gather and “you” and “your” means you, our client or potential client<br>who is booking a place on one of our courses or sessions.<br></p> <p>All vouchers purchased through We Are The Helpful must be utilised within 12 months from purchase</p> <p>'Gather' Antenatal Workshops</p> <p>Grow+Gather antenatal courses and active birth workshops sessions are provided&nbsp;by practicing midwives Hannah Webster and Hailey Jones who run the Grow + Gather company.&nbsp;</p> <p>The course and session content is evidence based and based on the experience&nbsp;of our midwives to give you a broader understanding of pregnancy, birth and initial&nbsp;newborn care, in line with current professional standards.&nbsp;</p> <p>The courses and sessions are designed to supplement information offered by your&nbsp;hospital and your own midwife that you will be using in connection with the birth&nbsp;and your pregnancy.</p> <p>All information and materials received on the course are not medical advice, they are for general information purposes only.&nbsp; Any questions about your own personal health, your pregnancy or your baby, must be directed to your GP, obstetrician, midwife or health visitor.</p> <p>The courses will be provided at the locations indicated on our Website or privately (in your own home), in accordance with your booking.<br><br></p> <p>Depending on the course, light food and refreshments may be provided, so please ensure that you provide us with any dietary requirements at the time of booking the course.<br><br></p> <p>‘Bend and Breathe’ Active Birth Workshops<br>‘Bend and Breathe’ active birth workshops sessions are provided by practicing midwives Hannah Webster and Hailey Jones who run the Grow + Gather company<br><br></p> <p>The course and session content is evidence based and based on the experience of our midwives to give you a broader understanding of preparation for labour and birth including, but not limited to; positions for labour, coping strategies for birth an introduction to hypnobirthing and the role of the birth partner<br><br></p> <p>The courses and sessions are designed to supplement information offered by&nbsp;the hospital and your own midwife that you will be using in connection with the birth&nbsp;and your pregnancy.</p> <p>All information and materials received on the course are not medical advice, they are for general information purposes only.&nbsp; Any questions about your own personal health, your pregnancy or your baby, must be directed to your GP, obstetrician, midwife or health visitor.</p> <p>The courses will be provided at the locations indicated on our Website or&nbsp;privately (in your own home), in accordance with your booking.<br></p> <p><br></p> <p>Child and Infant First Aid<br></p> <p>Grow and Gather Child and Infant first aid classes are provided by Laura Bigley<br><br></p> <p>Laura Bigley is an Ofqaul regulated first aid instructor and the materials provided are Grow +<br>Gather's own</p> <p><br>All information and materials received on the course are not medical advice, they are for general<br>information purposes only.&nbsp; Any questions about your own personal health, your pregnancy or your<br>baby, must be directed to your GP, obstetrician, midwife or health visitor.<br><br></p> <p>The courses will be provided at the locations indicated on our Website or privately (in your own<br>home), in accordance with your booking.<br><br></p> <p>Depending on the course, light food and refreshments may be provided, so please ensure that<br>you provide us with any dietary requirements at the time of booking the course.</p> <p>PRICES AND PAYMENT<br><br></p> <p>Payment must be made in full before your booking can be finally confirmed.<br>Prices can change at any time, but changes will not affect contracts that already<br>exist.&nbsp;</p> <p>YOUR CANCELLATION RIGHTS</p> <p>1.&nbsp; &nbsp; Without prejudice to your statutory rights of cancellation, you can cancel your<br>place on the any of courses, but only under these terms:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i.&nbsp; &nbsp; &nbsp; &nbsp; at least 21 days before a course is due to begin (in which case you<br>will be entitled to a full refund of the amount paid);</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ii.&nbsp; &nbsp; &nbsp; &nbsp; if you cancel your attendance at a course 14 working days or less<br>before a course is due to begin, or if you fail to attend a course, no refund will<br>be given;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;iii.&nbsp; &nbsp; &nbsp; &nbsp; a full refund will be offered if your baby arrives unexpectedly<br>before the course start date, as long as you contact us to tell us, as soon as is<br>reasonably practicable; and<br>&nbsp; &nbsp; &nbsp; &nbsp; iv.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a partial refund may be offered for any unattended sessions due to<br>your baby being born unexpectedly, as long as you contact us to tell us, as<br>soon as is reasonably practicable. You will not be refunded for any sessions<br>that you have already attended.<br>2.&nbsp; &nbsp; In order to cancel a contract in the 21 day cooling-off period above, you must<br>inform us by emailing one of the team and notice of this cancellation must be<br>received by us on or before the relevant date set out above.<br>3.&nbsp; &nbsp; If, for any reason Grow + Gather requires to change or reschedule a session or a<br>course, you will be given as much notice as possible. In the rare case that a course<br>venue needs to be altered, any new venue will be found nearby. In this situation no<br>refund will be offered.<br>4.&nbsp; &nbsp; If, for any reason Grow + Gather needs to cancel a session, you may request a<br>refund for that particular session.<br>5.&nbsp; &nbsp; If you have missed a session or inform us that you will no longer be able to<br>attend a particular session, you may be able to attend that particular session with a<br>different group as long as you pre-arrange this with us. However, if that is not<br>possible, you are welcome to book a private antenatal session through the process<br>set out above.&nbsp;<br>6.&nbsp; &nbsp; Please note that once payment has been made, your ticket is non-transferable.<br>This means that if for some reason you cannot attend and are not entitled to a<br>refund, you cannot put the money towards anything else with Grow + Gather,<br>including events or other courses.<br>7.&nbsp; &nbsp; If you cancel a contract and are entitled to a refund, we will usually refund you<br>using the same method originally used by you to pay for your purchase. We will<br>process the refund as soon as possible and, at the most, within 7 days of the day we<br>received your valid notice of cancellation. Once we have processed the refund, it<br>may take 5-10 working days for the refund to be back in your account.</p> <p><br>INTELLECTUAL PROPERTY<br>1.&nbsp; &nbsp;All intellectual property rights in or arising out of or in connection with the courses<br>and sessions are and will be owned or licensed by us.&nbsp;<br>2.&nbsp; &nbsp; Grow + Gather has a licence to use the KG Materials.</p> <p><br>CONFIDENTIALITY</p> <p>1.&nbsp; &nbsp;We each undertake that we will not at any time disclose to any person any<br>confidential information provided in connection with the courses and sessions.&nbsp;<br>2.&nbsp; &nbsp;Each of us may only use the other's confidential information for the purpose of<br>fulfilling our respective obligations under the contract.&nbsp;<br>G&nbsp; &nbsp; HOW WE MAY USE YOUR PERSONAL INFORMATION<br>1.&nbsp; &nbsp;We will use any personal information you provide to us to:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i.&nbsp; &nbsp; &nbsp; &nbsp; provide the courses and the sessions;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ii.&nbsp; &nbsp; &nbsp; &nbsp; process your payment for the courses and the sessions; and<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;iii.&nbsp; &nbsp; &nbsp; &nbsp; inform you about similar services that we provide, but you may stop<br>receiving these at any time by contacting us.<br>2.&nbsp; &nbsp;Further details of how we process personal information are set out in our Privacy<br>Policy.<br>H&nbsp; &nbsp; OUR RESPONSIBILITY FOR LOSS OR DAMAGE SUFFERED BY YOU<br>1.&nbsp; &nbsp;We are responsible to you for foreseeable loss and damage caused by us. If we<br>fail to comply with these Terms, we are responsible for loss or damage you suffer<br>that is a foreseeable result of our breaking this contract or our failing to use<br>reasonable care and skill, but we are not responsible for any loss or damage that is<br>not foreseeable. Loss or damage is foreseeable if either it is obvious that it will<br>happen or if, at the time the contract was made, both we and you knew it might<br>happen, for example, if you discussed it with us during the sales process.<br>2.&nbsp; &nbsp;We do not exclude or limit in any way our liability to you where it would be<br>unlawful to do so. This includes liability for death or personal injury caused by our<br>negligence or the negligence of our employees or for fraud or fraudulent<br>misrepresentation.<br>3.&nbsp; &nbsp; Any statutory rights which you have, which cannot be excluded or limited, will<br>not be affected by these Terms.<br>4.&nbsp; &nbsp; Except where liability is excluded in these Terms, Grow + Gather’s total liability to<br>you for any and all losses, claims or damages in connection with these Terms and<br>any contract is the total amount paid by you for the course or session.<br>5.&nbsp; &nbsp; The limitations and exclusions of liability set out in this section, and elsewhere in<br>these Terms are subject to the preceding paragraphs and govern all liabilities arising<br>under the Terms or in relation to the subject matter of the Terms, including liabilities<br>arising in contract, in tort (including negligence) and for breach of statutory duty.<br>6.&nbsp; &nbsp; We will not be liable to you in respect of any losses arising out of a force<br>majeure event (referred to condition J below).<br>I&nbsp; &nbsp; &nbsp; WARRANTIES</p> <p>1.&nbsp; &nbsp; We warrant that the services provided under these Terms will be provided with<br>reasonable skill and care.&nbsp;<br>2.&nbsp; &nbsp; You warrant and represent to us that:&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i.&nbsp; &nbsp; &nbsp; &nbsp; you are legally capable of entering into binding contracts, and you<br>have full authority, power and capacity to agree to these Terms;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ii.&nbsp; &nbsp; &nbsp; &nbsp; the information provided in or in connection with your booking<br>request is accurate and complete;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;iii.&nbsp; &nbsp; &nbsp; &nbsp; you will be able to attend the antenatal or the hypnobirthing course<br>or session at the time and at the place advertised or agreed;<br>&nbsp; &nbsp; &nbsp; &nbsp; iv.&nbsp; &nbsp; &nbsp; &nbsp; you meet the pre-requisites and qualification criteria for attending<br>the courses and sessions set out on our Website;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v.&nbsp; &nbsp; &nbsp; &nbsp; you shall co-operate with us in all matters relating to the courses<br>and sessions;<br>&nbsp; &nbsp; &nbsp; &nbsp; vi.&nbsp; &nbsp; &nbsp; &nbsp; you shall comply with all applicable laws, including health and<br>safety laws;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp;vii.&nbsp; &nbsp; &nbsp; &nbsp; you shall keep all of our books, materials and other property that we<br>provide to you as part of the course or session in safe custody at your own risk;<br>and<br>&nbsp; &nbsp; &nbsp; viii.&nbsp; &nbsp; &nbsp; &nbsp; you are at least 18 years of age.<br>J&nbsp; &nbsp; &nbsp;FORCE MAJEURE<br>A force majeure event means any event which is beyond our reasonable control.<br>Where a force majeure event gives rise to a failure or delay in us performing our<br>obligations under these Terms, those obligations will be suspended for the duration<br>of the force majeure event.<br>K&nbsp; &nbsp; GENERAL TERMS<br>1.&nbsp; &nbsp; Contracts under these Terms may only be varied by an instrument in writing<br>signed by both you and us. We may revise these Terms from time-to-time, but such<br>revisions will not affect the terms of any contracts which we have entered into with<br>you.<br>2.&nbsp; &nbsp; If any provision of these Terms is held invalid or unenforceable by a court of<br>competent jurisdiction, the remaining provisions will remain in full force and effect,<br>and such invalid or unenforceable provisions or portion thereof will be deemed<br>omitted.<br>3.&nbsp; &nbsp; No waiver of any provision of these Terms, whether by conduct or otherwise, in<br>any one or more instances, will be deemed to be, or be construed as, a further or<br>continuing waiver of that provision or any other provision of these Terms.</p> <p>4.&nbsp; &nbsp; You may not assign, charge, sub-contract or otherwise transfer any of your rights<br>or obligations arising under these Terms. Any attempt by you to do so will be null<br>and void. We may assign, charge, sub-contract or otherwise transfer any of our rights<br>or obligations arising under these Terms, at any time, providing, where you are a<br>consumer that such action does not serve to reduce the guarantees benefiting you<br>under these Terms.<br>5.&nbsp; &nbsp; Each contract under these Terms is made for the benefit of the parties to it and is<br>not intended to benefit, or be enforceable by, any other person. The right of the<br>parties to terminate, rescind, or agree any amendment, variation, waiver or<br>settlement under such contracts is not subject to the consent of any person who is<br>not a party to the relevant contract.<br>6.&nbsp; &nbsp; These Terms contain the entire agreement and understanding of the parties in<br>relation to the courses and sessions booked on our Website or by the other methods<br>set out above, and supersede all previous agreements and understandings between<br>the parties in relation to ours courses and sessions; and each party acknowledges<br>that no representations not expressly contained in these Terms have been made by<br>or on behalf of the other party in relation to the booking of a course or session on our<br>website.<br>7.&nbsp; &nbsp; These Terms will be governed by and construed in accordance with Scottish<br>law, and the courts of Scotland will have exclusive jurisdiction to adjudicate any<br>dispute arising under or in relation to these Terms.<br>L&nbsp; &nbsp; &nbsp;CONTACT<br>1.&nbsp; &nbsp; How to contact us. You can contact us by telephoning us at:<br>07876062440/07592 055036 or by writing to us at the email address:<br>hello@growandgather.co.uk<br>2.&nbsp; &nbsp; How we may contact you.<br>If we have to contact you, we will do so by telephone or by writing to you at the<br>email address you provided to us in your booking.&nbsp; If we have trouble contacting you<br>by either of those means, we will send you a text message by SMS.</p> <p></p> Grow+Gather A Grow+Gather hello@growandgather.co.uk +447876062440 none Y 1729701585 23 0 a:4:{s:14:"company_fields";a:6:{i:37;s:6:"Hannah";i:38;s:7:"Webster";i:53;s:6:"Midife";i:54;s:81:"Antenatal classes, active birth workshops, 1:1 sessions at home before/after baby";i:55;s:70:"Educated couples in their early 30s who are expecting their first baby";i:56;s:26:"Edinburgh and surroundings";}s:15:"admin_firstname";s:6:"Hannah";s:14:"admin_lastname";s:7:"Webster";s:6:"fields";a:0:{}} Grow+Gather 1 7 N N N 0 0 0 0 N 0 acct_1QNaObFLdJObo7VM S LAUNCH - 10% growgather 22_0