Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Max(max of 3 fields) + corresponding field
Message
 
 
À
23/10/2001 11:18:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00571821
Message ID:
00572085
Vues:
34
>>>Unfortunatly, it is not up to me to change the data structure. I know it is not the best structure, but I have to work with it. Normalizing the current table into a temp data sounds very do-able, although I'm not sure how that would be done. Any suggestion?
>>>THANKS!!
>>
>>Select "1" AS something, t1 As Tn, Goal1 AS Goal ;
>>  FROM table1 ;
>>Union All ;
>>Select "2" AS something, t2 As Tn, Goal2 AS Goal ;
>>  FROM table1 ;
>>Union All ;
>>Select "3" AS something, t3 As Tn, Goal3 AS Goal ;
>>  FROM table1 ;
>>INTO CURSOR crsNorm
>>
>>SELECT Tn, Goal From crsNorm;
>>  WHERE Tn In ( SELECT Max(Tn) From crsNorm)
>>
>>
>
>In different circumstances, I've had a problem numeric fields in UNIONS providing the full size of the field required. The first actual data that the SELECT finds seems to determine the size.
>
>I played around with a way of enhancing the UNION above, and it may be a workable approach in other situations.
>
>Include the following clause:
>
>
>UNION ;
>SELECT "0" as something, 0000000 AS tn, 0000000 AS goal ;
>    FROM table1 WHEN .F.
>
>
> Jay

First, there's no need for that if the fields t1, t2 and t3 are of the same size. Second, you can do it w/o creating an extra record
Select "1" AS something, 000000000 + t1 As Tn, 000000000+ Goal1 AS Goal ;
* and so on 
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform