Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not UNION compatible
Message
From
27/02/2002 10:05:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00625709
Message ID:
00625730
Views:
14
>>>Can anyone see why the following to cursors would NOT be union compatible?
>>
>>The fields have to have the same type and the same size. Even the same number of decimals, in the case of numeric data. The names of the resulting fields don't need be the same.
>
>Hmm. According to the hackers guide they don't have to be the same size.
>
There's one important set of rules for UNIONing queries. The field list for each query in the UNION must have the same number of items. Corresponding items must be the same type. The first query in the UNION creates the template for the result, so fields in subsequent queries must be no larger than those in the first query. (They can be smaller.) If you think about what's going on here, the whole set of rules makes sense.


I didn't know that - it's difficult to get hold of books here.

But you have your UNION the other way around - the smaller field first. The text you quoted from the HG says you should put the larger field first. Try to invert the query.

And to compare the structures, just do a DISPLAY STRUCTURE.

Hilmar.

>However the following is OK:
>
Select invoice.pk_id as invPK, ;
>	invoice.cCompanyName ;
>	from invoice ;
>
>Select Payment.fk_invoice_id as invPK, ;
>	Space(50) As cCompanyName ;
>	from Payment ;
>
>
>and these aren't
>
Select Payment.fk_invoice_id as invPK, ;
>	Space(0) As cCompanyName ;
>	from Payment ;
>** -- or --
>Select Payment.fk_invoice_id as invPK, ;
>	" " As cCompanyName ;
>	from Payment ;
>
>
>I would think they should all work based on the HG.
>
>I'm just whittling them down a line at a time until I find the offending field.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform