+---------------+ | sentence | +---------------+ | I like sql :) | +---------------+ 1 row in set (0.03 sec)
This query is a little unusual:
v1
, v2
and v3
are subqueries in the FROM
-clause. They act like tables with 2 columns and 3 rows each.
Because they are left joined, nulls are returned, which are then filtered out with the HAVING
-clause.
If one of the arguments in a CONCAT
is null, then the CONCAT
will return NULL
.
Usually HAVING
is used together with GROUP BY
, but it also works without.