Mysql automation- Sort Records from current day
by barkkathulla[ Edit ] 2013-03-01 16:05:45
Mysql automation- Sort Records from today
Key 1:
This idea is most usefull to sort records based on ascending sequence from current day.
Key 2:
select ,month(future_date) as nmonth from where
if(month(future_date)=MONTH(CURDATE()),day(future_date)>DAY(CURDATE()),day(future_date)>0)
ORDER BY
CASE WHEN month(future_date) >= month(date_add(current_date, interval 0 month)) THEN 0
else 1 END,
CASE WHEN month(future_date) >= month(date_add(current_date, interval 0 month)) THEN month(future_date)
else month(future_date)*-1 END,
CASE WHEN day(future_date) >= day(date_add(current_date, interval 0 day)) THEN day(future_date)
else day(future_date)*-1 END
Key 3:
This step is most useful in automation records like,
*scrolling display
*Moving slides based on seasonal requirements
*Year by year updation not required.