I've been thinking about this alot. Bear with me... If you had a cursor called labs and a cursor called hours, could you do the same thing, except maybe with a group clause? Then you could just issue a single select statement into a cursor that would actually be useful :-)
>I am trying to create a report for use of a computer lab. There are 5 separate sub-labs which I want to separate, and 17 different hours, 8 am - 12 midnight. The way I am currently using uses 17 * 5 or 85 select statements. As the log file size increases, these select statements could take quite a while. Is there a better (faster) way to do this?
>
>
>FOR labnum = 1 to 5
> FOR hournum = 8 TO 24
> SELECT uselog.time_in, uselog.time_out, computer.res_loc ;
> FROM uselog INNER JOIN computer ;
> ON ((uselog.comp_id = computer.res_id) AND (computer.res_loc = labnum) AND ;
> (BETWEEN(DTOT(gdreportdate)+(hournum*3600), uselog.time_in, uselog.time_out))) ;
> INTO CURSOR useless
> gausage[labnum, hournum - 7] = _TALLY
> SELECT useless
> USE
> ENDFOR
>ENDFOR
>
--Todd Sherman
-Wake Up! Smell the Coffee!