sql is SELECT DISTINCT(a.id), PROD.product_catid as product_category_id, PROD.customproduct_id, CUSTPROD.base_product_id as cust_base_product_id, a.*
FROM `ilogo_saveddesign` a
LEFT JOIN ilogo_product AS PROD ON PROD.ID = a.product_id
LEFT JOIN ilogo_customproduct AS CUSTPROD ON CUSTPROD.id = PROD.customproduct_id
LEFT JOIN ilogo_product AS BASEPROD ON BASEPROD.ID = CUSTPROD.base_product_id
LEFT JOIN ilogo_category AS CAT ON CAT.category_id = BASEPROD.product_catid
LEFT JOIN ilogo_createproduct_price AS PRICE ON PRICE.id = CUSTPROD.material
WHERE PROD.customproduct_id > 0 && CUSTPROD.id IS NOT NULL && a.design_ideas = 1 && a.design_category > 0 ORDER BY CAT.display_sorting ASC
LIMIT 0 , 20
Tailor-Made T-Shirt Designs in USA with colour combinations and cloth choices