Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tricky
Message
De
30/10/2007 03:55:48
 
 
À
29/10/2007 14:30:55
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Re: Tricky
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01264786
Message ID:
01264946
Vues:
13
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform