Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL UNION with Memo fields
Message
From
23/10/1997 12:01:28
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00056360
Message ID:
00056364
Views:
26
>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...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform