Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding Up SPT Statement Process
Message
From
04/02/2009 17:27:02
 
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:
01379363
Views:
20
Is there any other way to get the record with the greatest datstmpi value without having to use the middle select statment? I believe this may be what is slowing the process, having to pull 75000 plus records on every loop iteration.
( SELECT webprddt6.drawmfai.partno, MAX(webprddt6.drawmfai.datstmpi) AS MaxDate FROM webprddt6.drawmfai Where toolinspr = 0 And conformir = 0 And DATE(datstmpin) is Not NULL GROUP BY webprddt6.drawmfai.partno)
testString = "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 toolinspr = 0 And conformir = 0 And DATE(datstmpin) is Not NULL GROUP BY webprddt6.drawmfai.partno) mt3" +;
" ON mt3.partno = mt1.partno AND mt3.MaxDate = mt1.datstmpi" +;
" Where mt1.partno in('" + p1 + "','" + p2 + "','" + p3 + "','" + p4 + "','" + p5 + "','" + p1 + "','" + p1 +;
"') And toolinspr = 0 And conformir = 0"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform