i need make a join costum tables in my query. I need to do a cycle of all products ordered by categories of "entity_id" and join this select if is valid
SELECT *, pps_product_id, MIN(pps_last_unit_price) AS pps_last_unit_price, pps_quantity_product FROM ".Mage::getSingleton('core/resource')->getTableName('purchase_product_supplier')." WHERE pps_last_unit_price > '0' AND pps_last_unit_price != '' AND pps_product_id = ".$data['entity_id']." GROUP BY pps_product_id and join with SELECT *, COUNT(entity_id) AS conta FROM ".Mage::getSingleton('core/resource')->getTableName('catalog_category_entity_varchar')." WHERE attribute_id = 192 AND entity_id = ".$IDProduto." AND value != '' AND value != '0' if is valid. Anybody can help me? Thanks