mysql - How to make this eav query horizontal -
i want choose below table records have (property_id=18 , property_value=78) , (property_id=19 , property_value=113)
in table results record id = 12
.
link image of table.
here mysql query :
select distinct `product`.* , productmeta.property_id, productmeta.property_value `shop_products` `product` left join `shop_categories` `category` on (`product`.`category_id` = `category`.`id`) left join `shop_product_metas` `productmeta` on (`product`.`id` = `productmeta`.`product_id`) `product`.`category_id` = (26) , (`product`.`price` * (1 - (`product`.`off`/100)) ) >= '100' , (`product`.`price` * (1 - (`product`.`off`/100)) ) <= '5000000' , ( ( ((`productmeta`.`property_id` = 18) , (`productmeta`.`property_value` = '77')) or ((`productmeta`.`property_id` = 18) , (`productmeta`.`property_value` = '78')) ) , ((`productmeta`.`property_id` = 19) , (`productmeta`.`property_value` = '113')) )
Comments
Post a Comment