E
E
eldar_web2016-08-20 16:29:12
MySQL
eldar_web, 2016-08-20 16:29:12

How to sort by date from two fields in SQL?

Suppose there is a Period table with fields (of type string) period_start and period_finish.
There are such records:
1)period_start: 01/01/2014, period_start 12/01/2014
2)period_start: 01/01/2016, period_start 12/01/2016 3)period_start: 01/01/2015 ,
period_start 12/01/2015
period_start and period_finish) came out at the beginning and the old ones at the end?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2016-08-20
@Rsa97

Use columns of type DATE and convert dates to the standard format '2014-01-01' , then sort with regular ORDER BY as you like.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question