DotNetGnat
Programmer
Guys,
I am trying to subtract two dates(c.return, c.reserved as shown below) in an older mysql version in which new date functions doesnt work...
so far i have this query working fine...but i was looking for an efficient one...anyone has any suggestions on the efficiency improvement to this below query...
thanks in advance...
-DNG
I am trying to subtract two dates(c.return, c.reserved as shown below) in an older mysql version in which new date functions doesnt work...
so far i have this query working fine...but i was looking for an efficient one...anyone has any suggestions on the efficiency improvement to this below query...
Code:
String selectStatement = "select count(*) as total_reservations, sum((((time_to_sec(c.return) - time_to_sec(c.reserved))/60/60) "
+ " + ((to_days(c.return)-to_days(c.reserved))*9) "
+ " - ((week(c.return)-week(c.reserved))*18) "
+ " - ((year(c.return)-year(c.reserved))*936))) as total_hours";
thanks in advance...
-DNG