MySQL Forums
Forum List  »  Newbie

Re: sort by formatted date
Posted by: Peter Brawley
Date: February 11, 2022 10:59AM

Hmm, Union hides the column name, bummer, seems you have to do it this way ...

SELECT DATE_FORMAT(fecha, "%d-%b") as fdate, proveedor, importe
from (
select fecha, proveedor, importe
from db.tb
union
select fecha, proveedor, importe
from db2.tb
) x
order by x.fecha;

or form an ordering arg using substrings of fdate.

Options: ReplyQuote


Subject
Written By
Posted
February 11, 2022 02:16AM
February 11, 2022 09:45AM
February 11, 2022 10:19AM
February 11, 2022 10:21AM
Re: sort by formatted date
February 11, 2022 10:59AM
February 11, 2022 02:20PM
February 15, 2022 10:06AM
February 17, 2022 12:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.