I'm using the old wrong way for dates, and im unable to change it because it will take a lot of time and effort, not to mention a lot of crashes.
I have the following design:
- match_day : 31
- match_month : 12
- match_year : 2016
- time: 23:15
And comparing in the normal way ORDER BY (...etc)
won't work here, and i see that i need to convert it to time, but the thing is these are INT not string, but i've tried to use the following query:
SELECT match_day,match_month,match_year,time, STR_TO_DATE(match_day+'-'+match_month+'-'+match_year+'-'+time, '%e %c %Y %H:%i') AS date FROM SoccerMatches ORDER BY STR_TO_DATE(match_day+'-'+match_month+'-'+match_year+'-'+time, '%e-%c-%Y-%H:%i') DESC;
data
is NULL, and i don't think it will work because these are INT and i guess we can't use '-'
in queries.
this query:
SELECT match_day,match_month,match_year,time FROM SoccerMatches
result:
30 | 12 | 2016 | 23:15
Query im using and its showing false results:
Select t.*,plan_b.value From SoccerMatches t, plan_b Order by (t.match_year AND t.match_month AND t.match_day) DESC;
Any ideas how to make it work / beside creating a new column for it, i want a workaround.