Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need ODBC Valid SQL syntax
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00563510
Message ID:
00564204
Vues:
23
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform