Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Sql
Miscellaneous
Thread ID:
00339044
Message ID:
00339044
Views:
44
Hello,
In the following sql statement, I want to calculate total phone calls for each extension in a week. Can someone look at the sql statement and tell me why is the return value for each day is the same for each extension. For example, ext.# 224, the return value will be 200 calls for everyday, ext.# 500, the reurn value will be 10 calls for each day:

select alltrim(f_name) + " " + alltrim(l_name) as staff, ext, DEPT, sum(iif(cdow(start)= "Monday",LENGTH,0)) AS MON,;
sum(iif(cdow(start+1)= "Tuesday",LENGTH,0)) AS TUES, ;
sum(iif(cdow(start+2)= "Wednesday",LENGTH,0)) AS WED, ;
sum(iif(cdow(start+3)= "Thursday",LENGTH,0)) AS THU,;
sum(iif(cdow(start+4)= "Friday",LENGTH,0)) AS FRI ;
FROM STAFF, CALL_DET WHERE EXT == CALL_STN AND upper(alltrim(ACTION)) == "INCOMING CALL" GROUP BY EXT into cursor temp
thanks
sherry
Next
Reply
Map
View

Click here to load this message in the networking platform