General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Dear Cetin,
It's working ! Ive adapted your code, and also the last code you sent me to make cursors read-write.Thanks very much.I'm very grateful to you !
Sorry for the delay. My work keeps me constantly on the move, so there are som inevitable gaps in my programming.
I am enclosing the code for you to read:
Sele gcode as gangId, gname as pname from gang into cursor crstemp
use dbf("crstemp") in 0 again alias gang1
Use In "Crstemp"
Sele cgang as gangId,ddate as workdate ,nmen from dailywork into cursor crstemp
use dbf("crstemp") in 0 again alias workhrs
Use In "Crstemp"
Sele gcode as gangId,ddate as wagedate,nmen from gang into cursor crstemp
use dbf("crstemp") in 0 again alias wagehistory
Use In "Crstemp"
Select gang1
Index On gangid Tag gangId
Select Workhrs
Index On workdate tag workdate
Index On gangId Tag gangId
Index On gangId+Dtoc(workdate,1) tag workmain
Select wagehistory
Index On gangId tag gangId
Index On wagedate tag workdate desc
Index On gangId+DtoC(wagedate,1) tag wkmnIndex
Index On gangId+DtoC(wagedate,1) Tag wagemain Descending
*set order to gangId, wagedate && This is a new line by me the third line below
*wait wind
SELECT * from gang1
SELECT * from wagehistory ORDER BY gangId, wagedate
SELECT * from Workhrs ORDER BY gangId, workdate
*With 2 SQLs approach :
Select wk.gangId, wk.workdate, Max(wg.wagedate) As wagedate ;
FROM Workhrs wk ;
INNER Join wagehistory wg On wk.gangId = wg.gangId ;
where (wg.wagedate <= wk.workdate) ;
GROUP By wk.gangId, wk.workdate ;
INTO Cursor crsPass1 ;
nofilter
Select pr.gangId, pr.pname, ;
wg.wagedate, wg.nmen, ;
wk.workdate, wk.nmen, wk.nmen * wg.nmen As Calced ;
FROM gang1 pr ;
INNER Join crsPass1 p1 On p1.gangId = pr.gangId ;
INNER Join Workhrs wk On wk.gangId = pr.gangId ;
AND wk.workdate = p1.workdate ;
INNER Join wagehistory wg On pr.gangId = wg.gangId ;
AND p1.wagedate = wg.wagedate ;
ORDER By pr.gangId, wk.workdate ;
INTO Cursor crsPays ;
nofilter
browse
Just one last thing, Cetin. Could you tell me how to prevent browse windows opening when commands like "select * from wagehistory order by gangID" etc are executed ?
Regards,
Steve.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only