Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need ODBC Valid SQL syntax
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563510
Message ID:
00564204
Views:
22
>Try to use UNION like:
>
>*----------------------------
>SELECT Parent.Username, Parent.Phone, Child.KidFirstName, Child.KidLastName,
>StatusLookup.Status, PriorityLookup.Priority
>FROM Parent, Child, StatusLookup, PriorityLookup
>WHERE Parent.ItemKey = Child.ItemKey AND
>Parent.StatusKey = StatusLookup.StatusKey AND
>Child.PriorityKey = PriorityLookup.PriorityKey AND
>Parent.Username = 'SMITHBOB'
>UNION
>SELECT Parent.Username, Parent.Phone, ' ', ' ',
>StatusLookup.Status, ' '
>FROM Parent, StatusLookup
>WHERE Parent.ItemKey NOT IN (select Child.ItemKey from Child) AND
>Parent.StatusKey = StatusLookup.StatusKey AND
>Parent.Username = 'SMITHBOB'
>*---------------------------------
>
>ODBC may have problem with double ", so I would use single ' instead.
>UNION need related field sizes equal. So, include as many spaces as needed in the second statement above between ' '.
>
>Good luck
>

That worked just fine. The only thing I can add for any future person looking into the same problem is that you cant have memo fields involved with a Union. Once I eliminated the memo field from my code it worked ok. The real shame is the a Join (outer, left, right, whatever) could not be done here. It sure would have simplified the SQL query quite a bit. Thanks for the help.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform