Unanswered: Use different column in order by clause if value is NULL
I need some advice.
Let's say I have a table article(id, publ_date, creat_date) and I want to order this table by publ_date. Problem, sometimes publish date may be NULL, so only if the publ_date for a row is NULL I want MySQL to use the creat_date for the order by clause.
So I need a way to substitute the attribute value within the statement, only if the attribute is NULL, and then only for this specific row. I was thinking of creating a virtual column or using control flow functions, but both are new to me, so if anybody has some experience if this is possible using either of the two or any other ideas how to solve this, I would really appreciate your advice.