Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Optimization
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01066940
Message ID:
01066975
Vues:
18
Small update

This count the records that are unique per Doctor
SELECT  count(*) as llCount;
        FROM MYTABLE;
  WHERE MYTABLE.cstatus <> "XXX" ;
        AND BETWEEN(TTOD(MYTABLE.ddate), tDateFrom, tDateTo) ;
  GROUP BY docid;
  INTO  CURSOR curDocTot
This count the records that are unique per Doctor and caddress
SELECT  count(*) as llCount, UPPER(caddress) as Address;
        FROM MYTABLE;
  WHERE MYTABLE.cstatus <> "XXX" ;
        AND BETWEEN(TTOD(MYTABLE.ddate), tDateFrom, tDateTo) ;
  GROUP BY docid,Address;
  INTO  CURSOR curDocTot
>
>
>>Ok, I have a sql statement to count all the records that are unique per Doctor which looks similar to this...
>>
>>select doctor
>>do while !eof()
>> llcount = 0
>>
>> SELECT count(distinct(UPPER(ALLTRIM(MYTABLE.caddress)))) as llCount
>> FROM MYTABLE WHERE MYTABLE.docid = doctor.docid
>> AND MYTABLE.cstatus <> "XXX"
>> AND BETWEEN(TTOD(MYTABLE.ddate), tDateFrom, tDateTo)
>> INTO CURSOR curDocTot
>>
>> select newtable
>> append blank
>> replace newtable.count with llCount
>>
>> skip in doctor
>>
>>enddo
>>
>>Currently the MYTABLE contains more than 50K records. I also have an index in MYTABLE.ddate. My problem here is the speed of getting the NEWTABLE being populated, as I see it the bottle neck seems on the SELECT COUNT statment. Is there anything I can do to speed up that SELECT COUNT statment here? Please advice.
>>TIA!
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform