mercurio77 Posted April 14, 2008 Posted April 14, 2008 THIS QUERY IS TAKEN FROM THE ADVANCED_SEARCH_RESULT.PHP WITH THE EXTRA FIELDS CONTRIBUTE AND I WOULD LIKE TO PERFORM AN "AND" QUERY BETWEEN MULTIPLE VALUES I CHOOSE FROM THE EXTRA FIELDS TABLE select distinct p.products_image, m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id) left join manufacturers m on m.manufacturers_id=p.manufacturers_id left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((p2pef.products_extra_fields_value like '%205%' AND p2pef.products_extra_fields_id = 1) ) and ((p2pef.products_extra_fields_value like '%55%' AND p2pef.products_extra_fields_id = 2) ) order by pd.products_name HERE THE DUMP OF THE RELATED EXTRA FIELDS TABLE: CREATE TABLE `products_to_products_extra_fields` ( `products_id` int(11) NOT NULL, `products_extra_fields_id` int(11) NOT NULL, `products_extra_fields_value` varchar(64) default NULL, PRIMARY KEY (`products_id`,`products_extra_fields_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dump dei dati per la tabella `products_to_products_extra_fields` -- INSERT INTO `products_to_products_extra_fields` (`products_id`, `products_extra_fields_id`, `products_extra_fields_value`) VALUES (28, 1, '205'), (28, 2, '65'), (28, 3, 'R15'), (1, 1, '185'), (1, 2, '44'), (1, 3, 'R13'), (26, 1, '190'), (26, 2, '55'), (26, 3, 'R17'), (29, 1, '205'), (29, 2, '55'), (29, 3, 'R15'); FINALLY THIS IS THE URL I SEND TO THE SEARCH (FOR REFERENCE ONLY): http://192.168.0.245/public/catalog/advanc...dfrom=&dto= THANK YOU SO MUCH FOR ANY SUGGESTION MYSQL GURU WELCOME ;) Quote eBay certified API developer - Google Adwords API developer - OSC developer - SEO consultant - Italian, Rome based
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.