Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help creating a UNION in a SQL!!
Message
De
02/11/1999 16:50:21
Peter Brama
West Pointe Enterprises
Detroit, Michigan, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Help creating a UNION in a SQL!!
Divers
Thread ID:
00285763
Message ID:
00285763
Vues:
51
I am using 2 SQL statements to build a cursor to be used for a report.
The first SQL creates 3 "fields" that are based on SUMs of a variety of records from 3 seperate files.

The second SQL takes the first SQL's cursor and adds it's fields to another large SQL statement that provides the detail from again 3 seperate files + the first SQL cursor.

I thought this was working well UNTIL, the second SQL did not find any records that matched the search criteria for a particular client BUT the fields from the 1st SQL had values. The final record was completely dropped even though I needed the 1st SQL values to printout.

It has been suggested that I either....

make the 2nd SQL cursor writeable and codingly ADD the first SQL records to the cursor verbatim

or

use a UNION to join the 2 SQL with probably an ALL statement to get all records from BOTH SQLs.


I tried the UNION and keep getting coding errors. The problem is, I don't know how to CODE....

in the first SQL the place holders for the fields that are in the second SQL. They vary from text, numeric and dates. Then in the second SQL the place holders for the fields from the first SQL that were all SUMs of amount fields.

Apparently my problem is that I don't have the right number of fields and/or the right types. What I am running into is the first SQL isn't looking at all the same files so I don't have the field names to reference or whatever I need to do to get them.

Can someone explain this better than the online help and maybe give me a simple (yea right - is there such a thing with unions?) example or two?


Thanks
Peter Brama
West Pointe Enterprises

VFP is getting easier but STILL alot to learn!!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform