K
K
khodos_dmitry2018-06-15 12:46:44
MySQL
khodos_dmitry, 2018-06-15 12:46:44

Why is mysql query with BINARY running indefinitely?

SELECT BINARY `name` as bname, COUNT(*) FROM `param` GROUP BY BINARY `name` ORDER BY COUNT(*) DESC

this request is spinning for a long time.
How to properly select all unique values ​​and sort them by count?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2018-06-15
@kimono

SELECT
  BINARY `name` `bname`,
  COUNT(*) `cnt`
FROM `param`
GROUP BY `bname`
ORDER BY `cnt` DESC

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question