Why not try a join instead of multiple queries?
Something like:
Select SUM(RegHrs) AS TotalHours FROM TblMainEntry,TblDetailEntry,
Empl_General
WHERE TblMainEntry.EmpID = Empl_General.Employee_ID
AND tblDetailEntry.RecordDate = to_date('#currentdate#','mm/dd/yyyy')
I'm not sure exactly what you want, but I'm sure you could get the same
results with a few joins instead of doing multiple queries in a loop.
______________________
steve oliver
cresco technologies, inc.
http://www.crescotech.com
-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 2:12 PM
To: CF-Talk
Subject: RE: Problems with looping
Hey all,
I tried the two solutions offered, end neither of them worked.
The code is still only cycling over the first employee and simply not
moving to any other employee in the database. I'm at a complete loss as
to why, since the logic should be sound.
-Angel
-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]]
This is because you always access the first record from the outer loop
in the inner loop. Solution in your code below!
-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: maandag 21 januari 2002 16:02
To: CF-Talk
Subject: Problems with looping
Hey all!
Take a look at this code.
The idea of course, is to loop through all the employees in the table
and run a particular query against each employee.
_______________________________________________________
<CFQUERY name="GetEmployees" datasource="xxxxx" DBTYPE="ORacle80">
Select Employee_ID FROM Empl_General
</CFQUERY>
<CFOUTPUT query="GetEmployees">
<CFSET i = GetEmployees.currentRow> !!!!!!!!!!!!
<CFLOOP CONDITION="#CurrentDate# LESS THAN OR EQUAL TO
#EndDate#">
<CFSET CurrentDate=
DateFormat(#CurrentDate#,'mm/dd/yyyy')>
<CFQUERY name="GetHours" datasource="xxxx"
DBTYPE="Oracle80">
Select SUM(RegHrs) AS TotalHours FROM
TblMainEntry,TblDetailEntry
WHERE TblMainEntry.EmpID=
#GetEmployees.Employee_ID[i]# !!!!!!!!!!!!!!!!!!!!!!!!!!
AND
tblDetailEntry.RecordDate=
to_date('#currentdate#','mm/dd/yyyy')
AND tblMainEntry.MainID = TblDetailEntry.MainID
</CFQUERY>
<CFIF GetHours.TotalHours GT 24>
#GetHours.Employee_ID#    #GetHours.TotalHours#
</CFIF>
<CFSET CurrentDate = DateAdd("d",CurrentDate,1)>
</CFLOOP>
</CFOUTPUT>
_______________________________________________-
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists