I'm not very sure that i understand very well your problem but i suppose that if you don't have entries in your table(s) for weekends, is obvious that you can not show directly some results. To show what you wish i guess is better to use conditional IF() function. ie: SELECT IF(YOUR_FIELD_DEPARTMENT_FROM_TABLE=YOUR_INTERESTED_DEPARTMENT_ID,TO_DAYS(LAST_DAY)-TO_DAYS(FIRST_DAY),0)
Regards, Gelu _____________________________________________________ G.NET SOFTWARE COMPANY SYSTEM INTEGRATOR - AUTOMATION & SOFTWARE DEVELOPER Permanent e-mail address : [EMAIL PROTECTED] [EMAIL PROTECTED] -----Original Message----- From: Paul Hayer [mailto:[EMAIL PROTECTED] Sent: Wednesday, 28 January, 2004 6:14 PM To: '[EMAIL PROTECTED]' Subject: FW: CALCULATING DATES Thanks for the reply, I think SUM(DAYOFYEAR) has solved it. However is there a way of subtracting weekends and showing departments even if they have no entries( ie to show the dept and 0 as it's result)? Cheers. -----Original Message----- From: Gelu Gogancea [mailto:[EMAIL PROTECTED] Sent: 28 January 2004 15:08 To: Paul Hayer; [EMAIL PROTECTED] Subject: RE: CALCULATING DATES Hi, You can use TO_DAYS() and FROM_DAYS() functions for what you need. All details about Time and Date functions : http://www.mysql.com/doc/en/Date_and_time_functions.html Regards, Gelu _____________________________________________________ G.NET SOFTWARE COMPANY SYSTEM INTEGRATOR - AUTOMATION & SOFTWARE DEVELOPER Permanent e-mail address : [EMAIL PROTECTED] -----Original Message----- From: Paul Hayer [mailto:[EMAIL PROTECTED] Sent: Wednesday, 28 January, 2004 4:46 PM To: '[EMAIL PROTECTED]' Subject: CALCULATING DATES Hi, I want to be able to show the total of the subtraction of the "returned date" from the "from date" for each department for each month. This to be done on a range of a year, and then when the next month comes round for the calculation to take that month into account, so, shifting the range to calculate by a month forward. Thanks in advance. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]