1👍
✅
What you are essentialy trying is to coalesce columns of different data types. You haven’t specified your actual DB engine, but I can imagine only two sensible outcomes of such operation:
- Throw error, which is not your case
- Cast both columns’ data types to common ancestor, if such ancestor exist, or to string type otherwise
Looks like in your case it’s second option.
If you are trying to order by bm_rank
then by sales_rank
then by created_at
you actually can do it without coalescing at all using order_by, like:
self.projects(order_by=["bm_rank", "sales_rank", "created_at"])
👤J0HN
Source:stackexchange.com