Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select with additional conditions
Message
De
14/11/2007 10:10:56
 
 
À
14/11/2007 07:32:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01268865
Message ID:
01268906
Vues:
12
OK, Problem solved...
SET enginebehavior 90

SELECT A.ddate,;
B.Block,;
C.cname as name,;
C.narea as area,;
ROUND(iif(not isnull(c.nspx) and not isnull(c.nspy) and C.nspx<>0 and C.nspy<>0,C.narea*(43560/(C.nspx*C.nspy)),C.nrdmPlants),2) as Plants,; 
ROUND(D.plants,2) as TotPlants,;
ROUND((A.nmen/D.plants)* iif(not isnull(c.nspx) and not isnull(c.nspy) and C.nspx<>0 and C.nspy<>0,ROUND(C.narea*(43560/(C.nspx*C.nspy)),0),C.nrdmPlants),2) as Spread, ;
C.nspx as spx,C.nspy as spy,A.nmen as Men;
FROM Dailywork2 A ;
Inner Join Block2 B ;
On A.cblock=B.block ;
Left Outer JOIN ;
BlockProfile C ON A.cblock = C.cparent;
Left OUTER Join ;
(select C.cparent,sum(iif(not isnull(c.nspx) and not isnull(c.nspy) and C.nspx<>0 and C.nspy<>0,C.narea*(43560/(C.nspx*C.nspy)),0))+(SUM(C.nrdmPlants))as Plants ;
FROM BlockProfile C  group by cparent WHERE BETWEEN(dailywork2.ddate ,C.dstart,C.dend)) D ;
on D.cparent=A.cblock ;
WHERE BETWEEN(A.ddate ,C.dstart,C.dend)
The 2 Betweens have done the trick! Wonder why I wasn't getting this result before...

Steve
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform