Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding Up SPT Statement Process
Message
 
 
To
05/02/2009 08:13:40
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01379289
Message ID:
01379439
Views:
33
>My data source is db2, an iSeries/AS400 machine. What if I put all my filter criteria in the middle SQL statement. It seems to work a lot faster but I am not sure it will yeild the correct results in every situation. Here is the modified code.
>
>
>sql = "Select recseq, CASE WHEN faistatus = 1" +
>					" THEN 'Accepted' WHEN faistatus = 2 THEN 'Rejected' ELSE 'SEE ORIGINAL FAI' END" +
>					" As fais, inspectord, dwgrev, datstmpi From webprddt6.drawmfai mt1" +	
>					" JOIN ( SELECT webprddt6.drawmfai.partno, MAX(webprddt6.drawmfai.datstmpi) AS MaxDate FROM webprddt6.drawmfai" +
>					" Where partno in('" + p1+ "','" + pnmod + "','" + modpartno + "','" + LEFT(p1,11)+ "','" + Left(p1,10)+ "','" + Left(p1,9) + "','" + Left(p1,8) +
>					"') And toolinspr = 0 And conformir = 0 And DATE(datstmpin) is Not NULL GROUP BY webprddt6.drawmfai.partno) mt3" +
>					" ON mt3.partno = mt1.partno AND mt1.datstmpi = mt3.MaxDate";
>									
>
>
If you don't have duplicate dates for each PartNo, this query will yield the same results as the original.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform