Hi all,
We have a product table in the database. One of the columns is ProductGroup which we use in the case when a product is available in multiple colours say a red, green or blue cap. So if a product has multiple colours we add each product to the table but also specify its group.
If the item doesn't have different colours we dont specify a group. Unfortunately we cannot modify the database the default value of the productGroup column is an empty string (actually it is a Foxpro database but my question is more of a SQL statement problem)
I need to list all products those with a ProductGroup and those without a ProductGroup. Now my problem is I need those which have a ProductGroup to only show the first record. GROUP BY does this but does not return the other rows as unique groups, since it automatically groups the products with no ProductGroup.
Can anyone guide me into how I could get all the products and only the first product of the grouped ones. Hope I'm clear enough
Thanks
We have a product table in the database. One of the columns is ProductGroup which we use in the case when a product is available in multiple colours say a red, green or blue cap. So if a product has multiple colours we add each product to the table but also specify its group.
If the item doesn't have different colours we dont specify a group. Unfortunately we cannot modify the database the default value of the productGroup column is an empty string (actually it is a Foxpro database but my question is more of a SQL statement problem)
I need to list all products those with a ProductGroup and those without a ProductGroup. Now my problem is I need those which have a ProductGroup to only show the first record. GROUP BY does this but does not return the other rows as unique groups, since it automatically groups the products with no ProductGroup.
Can anyone guide me into how I could get all the products and only the first product of the grouped ones. Hope I'm clear enough
Thanks
Comment