Custom view sorting plugin / handler
There is an error in your SQL so you're getting the column not found error.  If you break up your query, you should be able to get it.
Since this question has 1k views and no answers, and I just had to do this myself, here are some helpful resources for anyone looking to build their own Views custom sort plugin in Drupal 8/9.
First, this blog post on Medium by Oleksandr Trotsenko has a detailed tutorial on writing custom sorts and filters for Views.  The example is to take a product weight and weight unit fields to sort all products by weight, regardless of whether that weight is recorded in lb or kg. There are code examples for hook_views_data() and the views sort plugin.
There's another tutorial by Clare Ming on how to extend a datefield to add a sort that shows dates in the future first, and then dates in the past in reverse chronological order. It also has code examples.