You are here:  » Group by multiple columns

Support Forum



Group by multiple columns

Submitted by Vince on Wed, 2011-02-23 13:26 in

Hi David!

I have a little problem here, I'm using group by EAN but just found a problem in my website with it.

take a look here:
{link saved}

Have a look at this product: Cadac Carri Chef Deluxe, it appears three times on this page with exactly the same name because they all have a different EAN number.

Query: SELECT SQL_CALC_FOUND_ROWS * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, MATCH name AGAINST ('cadac carri chef') AS relevance FROM `pt_products` WHERE MATCH name AGAINST ('cadac carri chef') GROUP BY ean ORDER BY relevance DESC LIMIT 0,15

I searched everywhere for multiple grouping, GROUP BY ean, name should work but it doesn't..

It is now looking very confusing with exactly the same product showing multiple times.

Hope you can help me.

Cheers!
Vince.

Submitted by support on Wed, 2011-02-23 15:07

Hi Vince,

I think the best solution in this scenario is to run a post-import process to match up product names and ean values. In other words, for every product without an ean, if it has the same product name as one that does have ean then set the ean to be the same.

As you will be selecting by ean on the product page this has the added benefit of making sure that all variations are compared together. I have a script to do this which I will email to you...

Cheers,
David.
--
PriceTapestry.com