Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with sql select using multiple tables
Message
 
To
13/07/1998 13:49:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00116859
Message ID:
00116888
Views:
11
>Hello:
>
>I'm trying to pull information into a report based on conditions
>from 3 tables using select statements. I'm storing this in a cursor that then will produce my report. My problem is that I want the results of the first select statement, that uses two tables, put in a cursor and then get the these results to match and ultimately print the information from my main table. Can I append from one cursor to another to do this or is there an easier way. My code is as follows:
>
>select cs.sin from coun_sum, act_plan ap where cs.sin = ap.sin;
>and !empty(ap.follow_dte) order by cs.sin into cursor test
>
>I want these cs.sins to match my client.sins from my client table and print the client information into a report.
>
>
>So I need another select statement based on the result of the first select statement. i.e. , if I get 10 sin numbers from my select statement I want the matched sin in the client table to print to my report.
>
> Any help would be greatly appreciated.

Sheeena,

Try this;
SELECT cs.sin ;
  FROM coun_sum, act_plan ap ;
 WHERE cs.sin = ap.sin ;
   AND !EMPTY(ap.follow_dte) ;
 ORDER BY cs.sin ;
  INTO CURSOR test

USE Clients IN 0 ORDER Sin
SET RELATION TO Sin INTO Clients
REPORT FORM WhatEver TO PRINT NOCONSOLE
Just make sure that the field in the report use the alias Cleints.Name to refer to the proper work area.
Previous
Reply
Map
View

Click here to load this message in the networking platform