>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,
I think the distinct is applied after the data has been fetched
Maybe a scan can help where you add one to the last char of rcode (and if that becomes 256, make it 0 and add one to the char before), then seek() fro the next
Gregory