SORTBY clause with SELECT directive ...

Started by jhendrickx00, August 04, 2024, 10:36:32 AM

Previous topic - Next topic

jhendrickx00

  Hi, I thought there was a SORTBY clause in the SELECT directive... but looking the documentation, I can't find it... If I'm wrong (the most likely), there is a simple way to add a sorting method while using the SELECT..NEXT RECORD construct?

  What I 'need'? some like this:

select * from table$ where city$="Caracas" sortby codigo$
 ...
next record

Note: Of course I can use the KNO clause, but sometimes the required field (for sorting) isn't a key.

  Thanks,
  Jean H//

Stéphane Devouard

#1
Hi Jean

As far as I know, there is no SORTBY clause in the PxPlus SELECT, and I do not see any simple one-liner trick that would allow you to sort your results if the field is not indexed in an alternate key.

You'd need to pre-load the data in some temp or memory file.

Regards
Stéphane Devouard
Portfolio | Work

jhendrickx00

  Yes, I thought I have seen it around ... but for sure my mind is playing with me ...  :P