Help please create a request. There is a selection of 2 tables:
SELECT distinct PA.$field as val_id, V.`".$lang->get("name")."` as value_name, V.image, PA.count FROM `#__products_attr` as PA INNER JOIN #__attr_values as V ON PA.$field=V.value_id WHERE PA.product_id=".(int)$this->product_id." ORDER BY count DESC, value_name ASC" a table is formed, but it turns out porridge as an additional sorting occurs by quantity. The question is whether it is possible to make a 2nd sorting with respect to 0 in one query so that the table would look like
those. first arrange all ascending if the column count> 0, and then arrange all ascending if count <0
val_id. value_name. count
1 ....... 33 ....... 24
2 ....... 34 ....... 77
3 ....... 35 ....... 12
4 ....... 16 ....... 0
5 ....... 17 ....... -5
6 ....... 19 ....... 0
order by (count<=0) asc, ...- Mike