Solutions Miscellany

This section is something of a grab bag; it shows how to write queries that solve various kinds of problems. For the most part, these are solutions to problems that I've seen come up on the mailing list. (With thanks to people on the list who've contributed many of these answers.)

Rewriting Subselects as Joins

MySQL will have subselects as of version 3.24. Lack of this feature is one of the more-often lamented omissions in MySQL, but something many people seem not to realize is that queries written using subselects often can be rephrased in terms of a join. In fact, even when MySQL gets subselects, it wouldn't be a bad idea to examine queries that you may be inclined to write in terms of them: It's often more efficient ...

Get MySQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.