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
Title:
Union incompatibility error
Miscellaneous
Thread ID:
00411393
Message ID:
00411393
Views:
33
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.

TIA

Jim
Jim Wheelock
Next
Reply
Map
View

Click here to load this message in the networking platform