Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL UNION with Memo fields
Message
 
To
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:
00056374
Views:
25
>>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

I don't think that's quite what I'm after. Table1's structure is Readdate (Date) and Comments (Memo). Table2's structure is Readdate (Date) and Cparam (Memo). What I want to end up with is a cursor with a structure of Readdate (Date), Comments (Memo) and Cparam (Memo). I believe my SQL should be something like this:

SELECT ReadDate, Comments, MyField1 ;
FROM MyTable1 ;
UNION ;
SELECT ReadDate, MyField2, Cparam ;
FROM MyTable2 ;
ORDER BY 1 ;
INTO CURSOR ac_Cursor

MyField1 has to be the same type and size as Cparam and the same is true for MyField2 and Comments for the UNION to work. Since both Comments and Cparam are Memo fields, how do I define the dummy values of MyField1 and MyField2?
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform