I agree with Jason. RBase should include the option of allowing an order by clause when LISTOF is used. One should not have to jump through hoops i.e. creating a view. To get a list of items. After all it may not be in primary key order that you want the list returned.
For example, if I want to do a WHERE IN or WHERE NOT IN list comparison having the most likely to match items first in the list speeds up the search and uses less computer resources. Jim Bentley American Celiac Society [email protected] tel: 1-504-737-3293 ________________________________ From: Jason Kramer <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Tue, March 23, 2010 9:55:36 AM Subject: [RBASE-L] - Re: LISTOF question 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 > >

