Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to combine results of 3 SELECT - SQL commands?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00618474
Message ID:
00618503
Views:
10
Nadya;

A minor point for those that are not aware of the behavior Create Cursor.

CREATE CURSOR creates a temporary table that is opened exclusively regardless of the setting of SET EXCLUSIVE.

If you are on a local machine that is not a problem. On a network it can bite you depending upon what you are doing.

Tom




>
>select 0
>Create cursor myTotalCursor (Field1 C(10), Field2 I, ...)
>** 3 selects
>append from dbf('Cursor1')
>append from dbf('Cursor2')
>append from dbf('Cursor3')
>
>
>
>>I have 3 unique SELECT-SQL commands within each CASE command. Following is the code for the commands. All I want to know is the best way to combine the results (cursors) into one cursor or combine the SELECT-SQL commands into one giant SQL command that would accomplish the same thing as combining the cursors into one for an overall report.
>>
>>I am going to put the combined code within the CASE called MISSING PROVIDERS for the Missing Providers report. What is the best way to do this? THANK YOU!
>>
>>The individual SELECT-SQL commands are working fine.
>>
>>* CASE ALLT(THISFORM.cboType.DisplayValue) = "MISSING PROVIDERS"
>>
>>*******	(Add code here for Missing Providers Report) *******
>>
>>* REPORT FORMAT missrpt.frx NOCONSOLE PREVIEW
>>CASE ALLT(THISFORM.cboType.DisplayValue) = "MISSING AGENCY PROVIDERS"
>>        USE c:\data\reference\units IN 0 SHARED
>>	SELECT DISTINCT units.agency FROM units WHERE units.agency ;
>>	   NOT IN (SELECT observe.agency FROM observe) AND ;
>>	   observe.date>=CTOD(sdate) AND observe.date<=CTOD(edate) AND ;
>>	   (ALLT(observe.activity) <> "Visit- Station" AND ;
>>	   ALLT(observe.activity) <> "Visit- Hospital") INTO CURSOR agncy
>>        SELECT agncy
>>*       REPORT FORMAT missagncyrpt.frx NOCONSOLE PREVIEW
>>	SELECT units
>>	USE
>>CASE ALLT(THISFORM.cboType.DisplayValue) = "MISSING FIRE STATION PROVIDERS"
>>	USE c:\observe\firehous IN 0 SHARED
>>	SELECT DISTINCT * FROM firehous WHERE firehous.statn_id ;
>>	   NOT IN (SELECT observe.unit FROM observe) AND ;
>>	   observe.date>=CTOD(sdate) AND observe.date<=CTOD(edate) AND ;
>>	   ALLT(observe.activity) = "Visit- Station" INTO CURSOR fire
>>	SELECT fire
>>*	REPORT FORMAT missfirerpt.frx NOCONSOLE PREVIEW
>>	SELECT firehous
>>	USE
>>CASE ALLT(THISFORM.cboType.DisplayValue) = "MISSING HOSPITAL PROVIDERS"
>>	USE c:\observe\hospital IN 0 SHARED
>>	SELECT DISTINCT * FROM hospital WHERE hospital.hospid ;
>>	   NOT IN (SELECT observe.unit FROM observe) AND ;
>>	   observe.date>=CTOD(sdate) AND observe.date<=CTOD(edate) AND ;
>>	   ALLT(observe.activity) = "Visit- Hospital" INTO CURSOR hosp
>>	SELECT hosp
>>	REPORT FORMAT misshosprpt.frx NOCONSOLE PREVIEW
>>	SELECT hospital
>>	USE
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform