我有SQL查詢返回一些工作人員去年的平均利用率。如何在SQL QUERY中計算WEEKENDS?
SELECT Name, AVG (hsum)
FROM
(
SELECT Name,sum((number_hours)/8)*100 AS hsum
FROM
T1
WHERE name='PERSON_A' and bookeddate>='2012-01-01' and booked_date<='2012-12-31'
GROUP BY name,booked_date
) t
現在我想排除週末的預訂日期來計算?怎麼做?我用mysql 謝謝
這是否幫助你嗎? http://stackoverflow.com/questions/1828948/mysql-function-to-find-the-number-of-working-days-between-two-dates – Cynical