$sql= mysql_query("SELECT DISTINCT categoria,subcategoria FROM tabla WHERE condiciones.. ORDER BY id DESC LIMIT 0, $limite");