Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I am stumped?!? SQL SELECT not working?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
I am stumped?!? SQL SELECT not working?
Divers
Thread ID:
00398111
Message ID:
00398111
Vues:
56
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.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform