I am trying to build a MySQL query that has order by expression. This is what I am trying to do:
SELECT * FROM tbl_product ORDER BY retail_price ONLY IF wholesale_price IS NULL OTHERWISE ORDER BY wholesale_price.
I donβt know where to start. I found an article that uses ORDER BY COALESCE, but I also found that this might have performance issues.
Any advice is appreciated.
puks1978
source share