Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combine 5 tables to 1 cursor
Message
From
12/06/2018 15:35:13
 
 
To
12/06/2018 12:01:42
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01660692
Message ID:
01660697
Views:
71
>strategies after targets, but I'd switch to a general "send" cursor with a "how" field filled with code to signify [TO, CC, BCC]
>which is identical to the union of the 3 send-cursors with target field for alternative 1...
>
>>Hi,
>>
>>I am struggling to construct one cursor from 5 tables
>>
>>Table with content
>>
>>create cursor curnames (id i, name c(10), email c(10))
>>insert into curNames values (1,"koen","koen@gmail.com")
>>insert into curNames values (2,"john","john@gmail.com")
>>insert into curNames values (3,"rob","rob@gmail.com")
>>insert into curNames values (4,"bill","bill@gmail.com")
>>insert into curNames values (5, "annet", "annet@gmail.com")
>>insert into curNames values (6, "maria", "maria@gmail.com")
>>
>>create cursor curEmail ( id i, content c(10))
>>insert into curEmail fields( id, content) values (11,"test")
>>
>>create cursor curSendTo ( id i, iemail i, iname i))
>>insert into curSendTo fields (id, iemail, iname) values (1,11,2)
>>insert into curSendTo fields (id, iemail, iname) values (2,11,1)
>>
>>create cursor curSendCC ( id i, iemail i, iname i))
>>insert into curSendCC fields (id, iemail, iname) values (1,11,3)
>>insert into curSendCC fields (id, iemail, iname) values (2,11,6)
>>
>>create cursor curSendBCC ( id i, iemail i, iname i))
>>insert into curSendBCC fields (id, iemail, iname) values (1,11,4)
>>
>>would like to have a cursor showing:
>>
>>cursendEmail
>>either
>>((fields: Name,email,content,send))
>>John,john@gmail.com,test,sendto
>>Koen,koen@gmail.com,sendto
>>Rob,rob@gmail.com,test,sendcc
>>Maria,maria@gmail.com,sendcc
>>Bill,bill@gmail.com,sendbcc
>>
>create a UNION of all inner joins of the 3 send tables wth first 2 tables where origin table fills last field
>
>>or
>>
>>(( fields: Name, iemail, content, sendto, sendcc, sendbcc))
>>John,11,Test,.t.,.f.,.f.
>>Koen,11,Test,.t.,.f.,.f.
>>Rob,11,Test,.f.,.t.,.f.
>>Maria,11,Test,.f.,.t.,.f.
>>Bill,11,Test,.f.,.f.,.t.
>>Somebody to assist me?
>
>create UNION of all combinations of cursors 1+2 found in send cursors with dummy send fields an run update statements,
>updates needed to allow distinct handling of UNION
>
>>
>>Regards,
>>
>>Koen

Thomas,
your solution 1 works OK for my first requirement and adapted a little bit with 3 extra fields which to be set .T. or .F. it also works for my second requirement. I find your solution 1 better than 2 with updating.
Thanks!
Regards,
Koen
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform