×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I want to use a simple example of case logic in a query for educational purposes, but I can't get it to work, so please help the trainer ('cause he's the expert, ahum...)
I tried this in all kinds of forms in ACS, but it keeps (at best) ignoring the order by and present me the first 10 records based on RRN
select REFKL, ORDAT, ORDNR
from TOVF
order by
case :SortCode
when 'A' then ' ORDAT asc '
when 'D' then ' ORDAT desc '
else ' REFKL asc '
end
limit 10;
I've googled around and found some examples resembling my approach, but not exactly the same. Most use an index number to designate a sort column from the select clause and don't bother about sorting sequence.
I also tried to move the ORDAT out of the case expression but that generates an error right away.
The same happens when I remove the apostrophs surrounding ' ORDAT asc' and the other result expressions.
I know other ways to get to the desired functional result but wanted to show the elegant simplicity of this construction.
What am I missing?
Kind regards, Met vriendelijke groet,
Martijn van Breden
lead software architect
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.