Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tricky
Message
From
30/10/2007 03:55:48
 
 
To
29/10/2007 14:30:55
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Tricky
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01264786
Message ID:
01264946
Views:
12
>Ciao Maestro Fabio!
>
>>Yours computation is exact ?
>
>No, it was a quick example of the intention.
>
>>
>>
>>CREATE CURSOR Employee (EmpID I,   EmpName V(20))
>>INSERT INTO Employee VALUES (1,       'Emp1')
>>INSERT INTO Employee VALUES (2,       'Emp2')
>>
>>CREATE CURSOR Work(WrkPK I, Wrk_EmpID I,   dWrkStart D,   dWrkTerminated D NULL)
>>
>>INSERT INTO Work VALUES (1,     1,  DATE(2007,01,01),NULL)
>>INSERT INTO Work VALUES (2,     2,  DATE(2007,01,04),DATE(2007,01,20))
>>
>>CREATE CURSOR  Rates	(RatPK I,  Ratdaily Y,      dRatStart D,    dRatEnd D NULL)
>>
>>INSERT INTO Rates	VALUES (1,     11,  DATE(2006,12,31),DATE(2007,01,05))
>>INSERT INTO Rates	VALUES (2,     12,  DATE(2007,01,06), NULL)
>>
>>dEnd = DATE()
>>
>>* LOOK FOR THE MIN AND MAX aggregation within a AGGREGATION SQL FUNCTION !!!!
>>SELECT Wrk_EmpID EmpID ;
>>	,	(SELECT EmpName FROM Employee WHERE Work.Wrk_EmpID = Employee.EmpID) EmpName ;
>>	,	SUM((	MIN(NVL(dRatEnd,m.dEnd) , NVL(dWrkTerminated,m.dEnd));
>>		-	MAX(dWrkStart,dRatStart) + 1)* Ratdaily ) Pay ;
>>		FROM Work JOIN Rates ON dWrkStart <= NVL(dRatEnd,m.dEnd) AND dRatStart <= NVL(dWrkTerminated,m.dEnd);
>>		GROUP BY Wrk_EmpID
>>
>
>Very interesting. Will study later!
>
>Mille Grazie!

You're Welcome.
Previous
Reply
Map
View

Click here to load this message in the networking platform