Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Report Trouble
Message
De
30/12/1999 12:54:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
30/12/1999 12:48:29
Jimmy Ditta
Twin City Electronics
Monroe, Louisiane, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00310435
Message ID:
00310525
Vues:
14
>>>It also looks like he has a blank line after each select statement, and each select statement has a continue to the blank line, but not the statement below.
>>
>>They're all seperate commands. Confusing (IMO), but syntactically valid.
>
>Nancy,
>
>I understand what's being said, and have given another attempt. Does this look better? (I haven't tested it yet):
>
>SELECT data1.bundle as Total12;
>FROM lumber!data1 into cursor bundata;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data2.bundle as Total22;
>FROM lumber!data2;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data3.bundle as Total32;
>FROM lumber!data3;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data4.bundle as Total42;
>FROM lumber!data4;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data5.bundle as Total52;
>FROM lumber!data5;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data6.bundle as Total62;
>FROM lumber!data6;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data7.bundle as Total72;
>FROM lumber!data7;
>WHERE siz = szValue and grade = gdValue and length = 2;
>union all;
>SELECT data8.bundle as Total82;
>FROM lumber!data8;
>WHERE siz = szValue and grade = gdValue and length = 2
>
>
>tb2 = bundata.Total12 + bundata.Total22 + bundata.Total32 + bundata.Total42 + bundata.Total52 + bundata.Total62 + bundata.Total72 + bundata.Total82


Looks better :) But be aware that you cannot exceed "select" count 10 in one SQL (seems OK here except column name should be same in all selects). Also as I remember you collect other lenghts too. So why not bypass "and length" and include length in selected fields. Would look like :
SELECT data1.bundle as Total12, length ;
FROM lumber!data1 into cursor bundata;
WHERE siz = szValue and grade = gdValue;
union all;
SELECT data2.bundle as Total12, length;
FROM lumber!data2;
WHERE siz = szValue and grade = gdValue ;
union all;
.... ;
into cursor myCursor ;
order by length
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform