Hi Experts,
I am trying to write a query which will calculate the time difference and then sum the total , and the result of it will be used again. I am new to SQL and VB6, so I very much apprreciate your help
Here is my query
I am using access DB but my production DB is SQL Server. So I need queries to run in both access and SQL server.HTML Code:strSQL = "SELECT Verifier, Sum(TOTALCLAIMS) as TotalDocs, sum(NUMKEYSTROKES)as TotalKS, sum(DATEDIFF('M',ENDTIME,STARTTIME)) as VERIFYTIME, (TotalKS/VERIFYTIME)*60 as KSHR, (KSHR/KSPerDoc) as DocsPerHour, (" & Norm & "/KSHR)*DocsPerHour as NormalizedDocsHR, (TotalKS/KSHR) as Hours, (Hours*60) as Minutes FROM VERIFY WHERE (VFYDATE Between #" & Format(DTPicker1.Value, "MM/DD/YYYY") & "# And #" & Format(DTPicker2.Value, "MM/DD/YYYY") & "#) Group by VERIFYTIME,Verifier"
My query was working fin until I added "sum(DATEDIFF('M',ENDTIME,STARTTIME)) as VERIFYTIME, (TotalKS/VERIFYTIME)*60 as KSHR" Now I am getting a run time error , too few paramers expected 1. I verified the column names and its not misspelled anywhere in the query.![]()




Reply With Quote