Answer the question
In order to leave comments, you need to log in
Why is query not working on mariaDB?
Hello. There is a SQL query:
SELECT * FROM (SELECT * FROM `b_users` WHERE `b_id`=4 ORDER BY `id` DESC) AS t GROUP BY `user_id`
SELECT * FROM `b_users` WHERE `b_id`=4 ORDER BY `id` DESC
Answer the question
In order to leave comments, you need to log in
So, when grouping, the sorting of the inner query does not have to be preserved. And in MySQL 5.7.5 and higher with default settings, such a query will generally generate an error; in queries with grouping by standard, you can only query the fields included in GROUP BY or the results of aggregate functions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question