Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SUM() in SQL statement
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00507278
Message ID:
00507294
Vues:
9
There are plenty of joins in this one. My goal is to have one record in the resulting cursor which is added as a string to a list box. This single record is also inserted into a table that is used to populate a report form.

Select Distinct A.LoomNumber,A.StartDate,A.EndDate,B.iobjnum As ObjNum,;
Left(C.cmodelnumber,20) as LoomType,C.ipicksperinch as LoomPPI,;
E.cgreigestylenumber as GSNumber,;
F.ipicksperinch as GStyPPI, F.inumberofstrips as Strips,;
H.ncompress as Compression,;
G.tstopstart as StopStart, G.tstopend as StopEnd,;
SUM(G.ipickcount) as Picks,;
SUM((G.ipickcount/(C.ipicksperinch*36))* H.ncompress) as Yardage;
From SQLBase A Left Join ObjParameters B on A.LoomNumber == B.cloomnumber;
Left Join ObjTypes C on C.iobjtypeid = B.iobjtypeid;
Left Join SegmentCurrent D on D.iobjnum = B.iobjnum;
Left Join SegStopsCurrent G on G.iobjnum = B.iobjnum;
Left Join GreigeStyles E on E.igrgstyid = D.igrgstyid;
Left Join GreigeStyleObjType F on F.igrgstyid = E.igrgstyid;
Left Join GreigeStylesWarps H on H.igrgobjid = F.igrgobjid;
Into Cursor curReport;
Where A.loomnumber = pcLoomNumber AND;
G.tstopstart >= CTOT(A.Startdate) AND;
G.tstopend <= CTOT(A.EndDate)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform