Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Union incompatibility error
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00411393
Message ID:
00411403
Views:
8
>I get the message "SELECTs are not UNION compatible" when I run the following query:
>
>SELECT c.contact_id,d.issue_id AS Chiave FROM ai_core a ;
> JOIN cextern b ON a.id_agency==b.id_agency ;
> JOIN dcontact c ON b.extern_id==c.extern_id ;
> JOIN dissues d ON c.contact_id==d.contact_id ;
> WHERE c.staff_ext=2 ;
>UNION ;
>(SELECT c.contact_id,d.req_id AS Chiave FROM ai_core a ;
> JOIN cextern b ON a.id_agency==b.id_agency ;
> JOIN dcontact c ON b.extern_id==c.extern_id ;
> JOIN dreqs d ON c.contact_id==d.contact_id ;
> WHERE c.staff_ext=2)
>
>The UNION works fine without the second field, so the problem lies there and not in the individual joins. The first SELECT includes "issue_id" which is CHAR 8 and the second SELECT includes "req_id" which is CHAR 4. I am told that the second part of the union can have fields that are the came data type and equal to or smaller than the comparable fields in the first part, which is the case here. Since the query was bombing, I added the AS title "Chiave" for each, hoping that would make them closer to matching. That doesn't work either.
>
>Any idea why the second field(s) make the UNION fail?? I need to chain these together with others to make a mega report, but I can't seem to get off the ground.
>

Yep - the fields must be identical in name, type and size in the union - try changing the second query's "d.req_id AS Chiave" to "d.req_id + SPACE(4) AS Chiave"
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform