example:
sh_date
30.11.2017
01.01.2018
31.12.2017
i want like this:
sh_date
30.11.2017
31.12.2017
01.01.2018
example:
sh_date
30.11.2017
01.01.2018
31.12.2017
i want like this:
sh_date
30.11.2017
31.12.2017
01.01.2018
try this one
select sh_date from table_name order by sh_date ASC
sh_date is a char or varchar and not a date otherwise your order by clause would be fine.
SELECT sh_date
FROM
table_name
ORDER BY
CONVERT(sh_date , EventDate,101) ASC
you will have to convert it to datetime and then you can order:
select sh_date
from table_name
order by convert(datetime, sh_date, 103) ASC
for further study : please go to this thread Order by date (varchar)?
As the date is varchar
you can try bellow one in mysql
SELECT sh_date
FROM table_name
ORDER BY STR_TO_DATE(REPLACE(sh_date ,'.',',') ,'%d,%m,%Y') ASC
Need to convert string to date before sorting
For eg:30.11.2017 it will convert to date
SELECT STR_TO_DATE(REPLACE('30.11.2017' ,'.',',') ,'%d,%m,%Y')
Output
2017-11-30
please add if anything is missing