Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select distinct & rushmore optimization
Message
From
24/10/2005 11:50:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
24/10/2005 11:28:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01061610
Message ID:
01061614
Views:
11
>So I have a table with close to a milion records and one of the fields called rcode char(6) contains codes, about 300 distinct values in the whole table.
>
>I need a way to get the list of unique values. It seems like neither of the following quesries are optimizable (according to sys(3054,11) there is no optmization used and the queries are slow)
>
>select distinct rcode from testtable
>select rcode from testtable group by rcode
>
>Any idea on how to get the list of unique values with an optimizeable query?
>
>thank you
>
>Sorin

Sorin,
Make sure cpcurrent() and cpdbf() matches. Then include a where clause on an existing index. ie: Assuming there is an index on upper(country)

SELECT distinct country FROM customer WHERE UPPER(Country)=''

However distinct by itself is slow. Having a unique index and copy to might produce faster results.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform