Mysql
 sql >> Database >  >> RDS >> Mysql

SQL esiste un modo per ordinare più colonne temporali in una preservando i metadati?

Potresti union tra più interrogazioni su tempi diversi:

(SELECT id, a_time AS time, metadata1, metadata2
 FROM   mytable)
UNION
(SELECT id, b_time AS time, metadata1, metadata2
 FROM   mytable)
UNION
(SELECT id, c_time AS time, metadata1, metadata2
 FROM   mytable)
UNION
(SELECT id, d_time AS time, metadata1, metadata2
 FROM   mytable)
ORDER BY time