Larry,
    Thanks.  That works.  I never considered using a view because the table is currently ordered (an unlikely to ever get out of order because the PK is an autonumber).  I just issued CREATE VIEW myview AS SELECT cols FROM mytable ORDER BY mycol.
    I still don't see why R:BASE does not sort the LISTOF.  If I understand the normal SELECT process vs. SELECT with an ORDER BY it goes like this:
NORMAL                        ORDER BY
Find all matches                    Find all matches
Display them as found           Sort them
                                            Display them

I though the sorting after all items are found was what caused the slight delay when an ORDER BY clause is used.  I though that a similar process would be used with LISTOF

NORMAL LISTOF                Order BY LISTOF
Find matches                                Find matches
Load into list                                Sort them
Display                                         Load list
                                                    Display


                                                            Thanks,
                                                            Jason
Jason Kramer
University Archives and Records Management
002 Pearson Hall
(302) 831 - 3127 (voice)
(302) 831 - 6903 (fax)

On 3/23/2010 10:28 AM, Lawrence Lustig wrote:
<<
Should the results of a SELECT LISTOF be sorted if the SELECT command has an ORDER BY clause?  
>>

No.  Think of what's happening internally in R:Base when you issue that SELECT statement:  R:Base is returning a result set with a single row containing the result of the LISTOF function.  The ORDER BY clause does, in fact, order the result set but since that result set has only a single row in it, there's not real meaning to the ORDER BY.

<<
If not, is there an easy to way to sort the resulting list, or would I have to write a sort routine myself?
>>

First, create a VIEW on the table that contains an ORDER BY clause.  Then perform your LISTOF query against the view, rather than the original table.
--
Larry





Reply via email to