W
W
wolk2015-09-28 22:08:27
MySQL
wolk, 2015-09-28 22:08:27

How to group and then sort in MySQL?

There is a table with products, the table has a column manufacturer, you need to group

SELECT manufacturer FROM items GROUP BY manufacturer ORDER BY manufacturer DESC

I receive the grouped but very strangely sorted list not alphabetically.
c98e6b0380.png
I tried to do it like this:
SELECT * FROM (SELECT manufacturer FROM tech_catalog_catalog1_items GROUP BY manufacturer) a ORDER BY a.manufacturer DESC

The result is the same :( What am I not so wishing for?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2015-09-28
@martin74ua MySQL Tag Curator

Base, table, field encoding? Sorting is in the order specified in the encoding.

I
Igor, 2015-09-29
@hurgadan

What type of field are you sorting by? What is the field length?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question