Fix “ERROR 1054 (42S22): Unknown column ‘colname’ in ‘order clause'” in MariaDB

If you’re getting error “ERROR 1054 (42S22): Unknown column ‘colname’ in ‘order clause’” in MariaDB, it may be that you’re trying to reference an aliased column by its column name.

This is a common error when running queries that join two or more tables. It can also happen when using operators such as UNION, INTERSECT, and EXCEPT.

Read more

MariaDB MINUS Operator Explained

In MariaDB, the MINUS operator returns distinct rows from the left input query that aren’t output by the right input query.

The MINUS operator was introduced in MariaDB 10.6.1 as a synonym for the EXCEPT operator for the purposes of compatibility with Oracle. Therefore, we can use MINUS and EXCEPT interchangeably (in MariaDB 10.6.1 and later).

Read more