Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not entirely clear until you provide table definition. Have you tried replacing count(xvi.variantid) with count(xiW.id) in the first query? </p> <p>updated:</p> <pre><code>SELECT xp.productid, xp.product, xc.classid, xco.optionid, xco.option_name, xiW.id, xiW.image_path, count(xvi.variantid) as cnt FROM xcart_products xp INNER JOIN xcart_variants xv ON xp.productid = xv.productid INNER JOIN xcart_variant_items xvi ON xv.variantid = xvi.variantid INNER JOIN xcart_class_options xco ON xvi.optionid = xco.optionid INNER JOIN xcart_classes xc ON xco.classid = xc.classid AND xc.class = 'COLOR' LEFT JOIN ( SELECT COUNT(xiD.id) as Dcount FROM xcart_images_D xiD INNER JOIN xcart_images_W xiW ON xiW.column = xiD.column /*please update accordingly */ ) ON xiW.id = xvi.variantid GROUP BY xco.optionid ORDER by xp.product DESC </code></pre> <p>updated again:</p> <pre><code>SELECT xp.productid, xp.product, xc.classid, xco.optionid, xco.option_name, xiW.id, xiW.image_path, count(xvi.variantid) as cnt, xiD.totalD FROM xcart_products xp INNER JOIN xcart_variants xv ON xp.productid = xv.productid INNER JOIN xcart_variant_items xvi ON xv.variantid = xvi.variantid INNER JOIN xcart_class_options xco ON xvi.optionid = xco.optionid INNER JOIN xcart_classes xc ON xco.classid = xc.classid AND xc.class = 'COLOR' LEFT JOIN ( SELECT count(xiD.id) as totalD, xiD.optionid FROM xcart_images_D xiD WHERE xiD.optionid = xvi.optionid ) ON xiD.optionid = xvi.optionid GROUP BY xco.optionid ORDER by xp.product DESC </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload