Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Max(max of 3 fields) + corresponding field
Message
From
23/10/2001 12:17:44
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00571821
Message ID:
00572110
Views:
33
>>>>
>>>>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
>>
>>No extra record is created in the clause because of the WHEN .F. condition. But, the addition does make a more concise expression.
>>
>
>I see. It certanly could be usefull. I'll add it to my list of SQl Select Tips & Tricks.

Somehow the "light went on" when I looked over your clean normalizing through the UNION. With that "dummy" clause, it's possible to create a complete record definition, which can be nice both for documentation and setup in a UNIONd SELECT.

> I'll add it to my list of SQl Select Tips & Tricks.

When are we going to see those in print? <g> Seriously, there's a lot to this SQL!

Jay
Previous
Reply
Map
View

Click here to load this message in the networking platform