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.

Continue reading

Fix Error “ORA-01790: expression must have same datatype as corresponding expression”

If you’re getting the error “ORA-01790: expression must have same datatype as corresponding expression” in Oracle Database, it’s probably because you’re using an operator such as UNION, INTERSECT, or EXCEPT to run a compound query, but the columns returned by each query use different data type groups.

To fix this issue, you’ll need to ensure that each column returned by the second query uses the same data type group as the corresponding column in the first query.

Continue reading