Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I am stumped?!? SQL SELECT not working?
Message
From
28/07/2000 10:58:29
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00398111
Message ID:
00398180
Views:
11
Steve,

There is a possibility that some path problem is causing this to grab the wrong table.

I would make a special copy of your 3 tables in some directory and give them different names to prevent picking up some other table from some other directory. Choose a small number of records so you know exactly what goes in and what should come out. Leave out the report for now and just run the SQL and look at the results. See if the problem becomes evident there.

Then examine your report. Are all the controls referring to FieldName rather than TableName.FieldName? Is Rpt the current work area? If you have to, open the report as a table and look through the Expr field to check that you are not somehow picking up some data that is not in the Rpt cursor. See if the problem becomes evident there.

Best of luck.


>All but one thing works and I don't see what's wrong. This SELECT works fine when I press RUN button in Project Window (I get 5 detail lines in my report and all the correct selections), but when I compile and run the .EXE it selects mostly duplicate detail lines for my report. (I get duplicate lines for 4 of the 5 detail lines in my report for a total of 9 detail lines). I know it has something to do with the LEFT JOIN for the Lookstat table. It seems to be selecting extra data from one or two other tables that are not even included in my SELECT. I know the SELECT is grabbing data from some other tables because the Lookstat table has only 4 descriptions in it and 4 lookup codes to go along with the 4 decsriptions and the duplicates are not showing data that is from my Lookstat table. For example Lookstat has a lookcode Char 1 of "U" and a lookdesc4 Char 40 description of "UNKNOWN". My lookouteyn LEFT JOIN seems to work fine and it is set up similar to my lookstat LEFT JOIN. BUT WHY
>doesn't this work after compilation when I run my .EXE, but this works fine when I just click the Run button in my project window?
>
>Here is my SELECT SQL code:
>
>SELECT a.edate, a.incident, a.agency1, a.unit_type1, a.unit_type2, ;
>	a.fdaps_time, a.fdfsh_time, a.fdpreptime, a.arrestaftr, a.md_initial, ;
>	a.ems_outcom, a.statarred, b.lookdesc1, c.lookdesc4 ;
>	FROM FORCE arrest a ;
>	LEFT JOIN \data\sca\lookouteyn b ON a.ems_outcom = b.lookcode1 ;
>	LEFT JOIN \data\sca\lookstat c ON a.statarred = c.lookcode4 ;
>	WHERE a.edate >= lcStartDate AND a.edate <= lcEndDate AND ;
>		((VAL(a.md_initial) > 0 AND VAL(a.md_initial) < 6) AND ;
>		(VAL(SUBSTR(a.fdpreptime,1,2)) < 1 AND ;
>		VAL(SUBSTR(a.fdpreptime,4,2)) = 1 AND ;
>		VAL(SUBSTR(a.fdpreptime,7,2)) < 30) OR ;
>		(VAL(a.md_initial) > 0 AND VAL(a.md_initial) < 6) AND ;
>		(VAL(SUBSTR(a.fdpreptime,1,2)) < 1 AND ;				
>		VAL(SUBSTR(a.fdpreptime,4,2)) < 1 AND ;
>		VAL(SUBSTR(a.fdpreptime,7,2)) > 29) OR ;
>		(VAL(a.md_initial) > 0 AND VAL(a.md_initial) < 6) AND ;
>		(VAL(SUBSTR(a.fdpreptime,1,2)) < 1 AND ;
>		VAL(SUBSTR(a.fdpreptime,4,2)) < 1 AND ;
>		VAL(SUBSTR(a.fdpreptime,7,2)) < 30 AND ;
>		a.arrestaftr = "Y")) ;
>	ORDER BY a.fdpreptime ;
>	INTO CURSOR rpt
>	SET ANSI OFF
>
>
>
>Something must be wrong somewhere, but I cant' find it. Thanks for the help. I might have to put this SELECT and report in a project all by itself and build a .EXE and run it and see if that fixes the problem. Any ideas? Never had this problem before.
Previous
Reply
Map
View

Click here to load this message in the networking platform