hi,
this statement should return groups of departments by location.
also should count total deals for each department(countdeal) and sum deals that are within current month(countcurdeal) and forward of current month(countfwdeal)
at the moment i get this error
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/dfasp2/dealgroup.asp, line 16
&"SUM( IF ( 100*Year(dealdeldate)+Month(dealdeldate) = 100*Year(curDate())+Month(curDate())), 1, 0 ) AS countcurdeal,"_
this statement should return groups of departments by location.
also should count total deals for each department(countdeal) and sum deals that are within current month(countcurdeal) and forward of current month(countfwdeal)
at the moment i get this error
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/dfasp2/dealgroup.asp, line 16
&"SUM( IF ( 100*Year(dealdeldate)+Month(dealdeldate) = 100*Year(curDate())+Month(curDate())), 1, 0 ) AS countcurdeal,"_
Code:
SQL = "SELECT TL.locid, TL.locname,TD.dealid, TD.userid, TD.dealdeldate, TDP.edeptdesc, TDP.edeptid,TU.userdeptid, TU.usersiteid,COUNT(TD.dealid) AS countdeal,"
&"SUM( IF ( 100*Year(dealdeldate)+Month(dealdeldate) = 100*Year(curDate())+Month(curDate())), 1, 0 ) AS countcurdeal,"_
&"SUM(IF( 100*Year(dealdeldate)+Month(dealdeldate) > 100*Year(curDate())+Month(curDate())), 1, 0 ) AS countfwdeal"_
& "FROM tbl_location AS TL, tbl_users AS TU, tbl_deal AS TD, tbl_dept AS TDP"_
& " WHERE tbl_users.usersiteid = tbl_location.locid "_
& "AND TU.userid = TD.userid"_
&"AND TU.userdeptid = TDP.edeptid "_
&"AND TU.usersiteid = TL.locid"_
& " GROUP BY TL.locid, TL.locname,TD.dealid, TD.userid, TD.dealdeldate, TDP.edeptdesc, TDP.edeptid,TU.userdeptid, TU.usersiteid "_
& " ORDER BY TL.locname, TDP.edeptid, TD.userid"
Set RS = catConn.Execute( SQL )