I don’t know much about Mysql and can’t figure how I would achieve the following. I want to select the 50 most expensive products, and I want to order them alphabetically. The following orders them by prize, but I don’t know how to grab those results and order them by something else (alphabetically).
SELECT * FROM `products` ORDER BY `prize` DESC LIMIT 50;
And, for what I’ve read so far about mysql this is a subquery, right? I thought subqueries were only supposed to return one result. I’m confused about that.
actually, a subquery in the SELECT clause may return only one row consisting of one column – i.e. a singular scalar value, which is why it’s called a scalar subquery
elsewhere (e.g. in the FROM clause, or in an IN list or EXISTS predicate) a subquery can return multiple rows
Thanks a lot for the help. That’s what was getting me confused. Subquries can really get quite complicated.
If someone knows of some good resources to learn about subqueries, I’ll greatly appreaciate if they could link to them. I’ve already read the official mysql documentation.