Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with cursors
Message
De
13/10/1999 22:37:34
 
 
À
13/10/1999 22:35:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00276127
Message ID:
00276170
Vues:
26
>>I am sure I am going about this the wrong way.
>>
>>Background:
>> FAMILY database is shared on a a network drive
>> The mailing address named (fm_????) and physical address (fp_????) are on the same record.
>>
>>Goal:
>> I want a (local) table that contains two rows, one for each address
>> (preferably not on the file server because of the multi-user)
>>
>>My poor attempt:
>>
>>select 'MAIL',fm_addr1,fm_addr2,fm_city,fm_state,fm_zip;
>> from family;
>> where family_id=fid;
>> into cursor x1
>>
>>select 'SITE',fp_addr1,fp_addr2,fp_city,fp_state,fp_zip;
>> from family;
>> where family_id=fid;
>> into cursor x2
>>
>>select x1
>>append from x2
>>
>>I get an error that the cursor is read-only.
>>
>>Your help is appreciated.
>
>As Mike and Barbara have told you, you can make a SELECT cursor R/W. But what I think you really want to do is a UNION:
>
>
>select 'MAIL',fm_addr1,fm_addr2,fm_city,fm_state,fm_zip;
>       from family;
>       where family_id=fid;
>       union select 'SITE',fp_addr1,fp_addr2,fp_city,fp_state,fp_zip;
>                    from family;
>                    where family_id=fid); /<-- remove the )
>       group by fid;
>       into cursor x1
>
>
>This will work as long as the field sizes are the same (fm_addr1 and fp_addr1, etc.)


Whoops, leave off the trailing ")" after the second where clause!
select 'MAIL',fm_addr1,fm_addr2,fm_city,fm_state,fm_zip;
       from family;
       where family_id=fid;
       union select 'SITE',fp_addr1,fp_addr2,fp_city,fp_state,fp_zip;
                    from family;
                    where family_id=fid;
       group by fid;
       into cursor x1
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform