|
Is the output of a SELECT command using LISTOF supposed to be
sorted if ORDER BY is used? For example, if I issue this command: SELECT part_id FROM products WHERE product_id IN (4,1,5,2,9,3,7) ORDER BY part_id I get this, which is what I expect. part_id ---------- 1 2 3 4 5 7 9 If I instead issue this command: SELECT LISTOF part_id FROM products WHERE product_id IN (4,1,5,2,9,3,7) ORDER BY part_id I get this: LISTOF(part_id) --------------- 4,1,5,2,9,3,7 when I expect this: LISTOF(part_id) --------------- 1,2,3,4,5,7,9 Should the results of a SELECT LISTOF be sorted if the SELECT command has an ORDER BY clause? If not, is there an easy to way to sort the resulting list, or would I have to write a sort routine myself? This question is really an offshoot of my attempts to sort a TEXT variable that contains a comma delimited list of INTEGER values. I need to compare two lists of integers and see if they contain the same values. The order within the list is immaterial, just the content must match. I know there will be no duplicates or NULLS in the list (i.e '1,,1,2,1' would never be a possible list). In my situation '3,1,9,11,2,10' is equal to '1,11,2,10,3,9'. I tried using SSTRIP(.vlist1,.vlist2), but this causes problems with two digit numbers because 1 will strip 1, 10,11,etc... Then I figured I can run the lists through a SELECT command (SELECT part_id FROM products WHERE product_id IN (&vlist) ORDER BY part_id, but I have to use the LISTOF command, which brings me back to my first question. Is there a way to sort a comma delimited list in R:BASE? I can write a routine to sort the list, but I was hoping that and find something that might already exist. As an add-on question, has anyone written a quicksort routine in R:BASE? Thanks, Jason -- Jason Kramer University Archives and Records Management 002 Pearson Hall (302) 831 - 3127 (voice) (302) 831 - 6903 (fax) |

