mysql query distinct only one row

Hello,

We are having a problem here with a query

[php]

$sql_produtos=“SELECT DISTINCT(ref), category, id, name FROM $tbl_name where activo=‘1’ order by id desc LIMIT $start, $limit”;

[/php]

We are working only with one table from the db because the content comes from an external software.
We have many products with the same ref and we have distinct to display only the content from that product.

We are trying to set the distinct to the ref field and then in the same query get other fields and/or filters.
But its not working. Anyone can help on this?

Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service