Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Attempting a UNION with a memo field
Message
From
23/11/2005 03:10:37
 
 
To
23/11/2005 03:04:44
Jill Derickson
Software Specialties
Saipan, CNMI
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01071377
Message ID:
01071482
Views:
25
>>>Hi,
>>>
>>>I am trying, and failing, to include a memo field in a UNIONed SQL SELECT. I've pared the statement down to the following:
>>>
>>>
>>>SELECT app_activitycomments ;
>>>	FROM appointments ;
>>>	INTO CURSOR c_Temp ;
>>>	WHERE !app_activity AND app_clientfk > 0 AND app_GroupnameFK=0 ;
>>>	UNION ;
>>>		SELECT app_activitycomments ;
>>>			FROM appointments;
>>>			WHERE !app_activity AND app_clientfk=0 ;
>>>			UNION ;
>>>				SELECT app_activitycomments ;
>>>					FROM appointments ;
>>>					WHERE app_activity
>>>
>>>
>>>and i get the error:
>>>
>>>"Operation is invalid for a Memo, Blob, General or Picture field"
>>>
>>>I can't have a memo in a UNION SQL SELECT statement?
>>>
>>>TIA, j
>>
>>Jill,
>>
>>With the UNION ALL you may end up with duplicate records
>>
>>The statement above can be rewritten without a UNION
>>
>>
>>SELECT app_activitycomments ;
>>    FROM appointments ;
>>    INTO CURSOR c_Temp ;
>>    WHERE  ( app_activity ) ;
>>        or ( app_clientfk > 0 AND app_GroupnameFK=0 ) ;
>>        or ( app_clientfk=0 )
>>
>>&& if app_clientfk cannot be negative
>>
>>SELECT app_activitycomments ;
>>    FROM appointments ;
>>    INTO CURSOR c_Temp ;
>>    WHERE  ( app_activity ) ;
>>        or ( app_clientfk = 0 ) ;
>>        or ( app_GroupnameFK=0 )
>>
>>
>
>Hi Gregory,
>
>Thanks for your input...but, the SELECT i posted here was a stripped down version (to illustrate my specific problem)...there are many other fields and tables involved in the real statement.
>
>I ended up doing the UNION ALL, then applied a UNIQUE index to get the unique records I needed.
>
>Thanks, j

hi Jill,

IC.

You could also safely select with union some pk or id of appointments into a cursor. Then join the cursor with appointments.
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform