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:
00618490
Views:
9
This message has been marked as the solution to the initial question of the thread.
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
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform