Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL UNION with Memo fields
Message
De
23/10/1997 12:01:28
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00056360
Message ID:
00056364
Vues:
31
>This has to be done in FoxPro 2.5 so views are not an option.
>
>I have 2 separate tables both with a date field and a memo field. Both date fields are called Readdate. The memo field in table1 is called Comments and table2's is called Cparam.
>
>What I need to end up with is a Cursor, combining both tables data, with Readdate, Comments, Cparam ordered by Readdate. How do I code the SQL-SELECT for this or is there a better way? My best idea so far is 2 SELECT's UNION'd together.
SELECT ReadDate, Myfield1 AS Field1, MyField2 AS Field2, Comments ;
  FROM MyTable1 ;
UNION ;
SELECT ReadDate, MyOtherField1 AS Field1, MyOtherField2 AS Field2, Cparam AS Comments ;
  FROM MyTable2 ;
ORDER BY 1 ;
INTO CURSOR ac_Cursor
The 'AS' commmands are redundant, I just put them in for clarification.

The Format for Myfield1 MUST match MyOtherField1 and likewise for 2.

HTH
Matt McDonnell
...building a better mousetrap with moldy cheese...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform