This is my query

SELECT DISTINCT brand, category FROM product WHERE subcategory = '$subcategory'

My problem is that i want the distinct to work on both brand and category, but it is only working on brand. How could i fix this?

You need to use 2 separate queries. Current query will give distinct combination of 2 colums

 SELECT DISTINCT  category FROM product WHERE subcategory = '$subcategory'

  SELECT DISTINCT brand FROM product WHERE subcategory = '$subcategory'
select b.brand, c.category
from 
(SELECT DISTINCT brand from product) b,
(SELECT DISTINCT category from product) c
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.