I have a table with several columns, and I want to sort the results by the values of one of the columns where another column in the same table is equal to a value.
I have already tried to implement the query with CASE
, IF's
and FIELD()
.
I want the results sorted by tech.value when tech.id_color = 5
Here is the query:
SELECT DISTINCT *
FROM products, tech_products
WHERE products.idsub = 1 AND
tech_products.id = products.id
ORDER by tech.id_cor = 5 AND tech.value ASC