Re: Sorting Integer
Posted in 1993
In article <1m0d5dINN79m@emory.mathcs.emory.edu> alan@effluvia.den.mmc.com (Alan Popiel) writes: >->For sorting by the last two digits of an integer, how about: >->select integer_num, >-> -(trunc(integer_num, -2) - integer_num) >->from table_name >->order by 2 > >->From: aland@informix.com (Colonel Panic) >->OR, in SQL, IF you have a 5.XX engine product, you can take advantage >->of the mod() function: >-> >->select intfield, mod(intfield, 100) last2 from tablename >->order by last2 > >Cathy, > >What version of Informix ISQL/ACE/engine/etc. are you running? I looked for >the TRUNC function in my 4.00 (and 4.10 supplement) manuals and did not see >it. Is it an ACE feature? I know you use ACE a lot, while I don't use it >at all. I see that Alan Denney tells us that MOD became available in v5.00 >of the engine. trunc() and round() are available in 4.1 or higher engines and are documented in the Informix Guide to SQL: Reference version 4.1, pp. 6-265 - 6-266. mod() doesn't seem to be documented in 5.0 but should be in 6.0. >I work on several platforms, running everything from 2.10.03F ISQL and >1.10.03F 4GL (both fossils), to 4.00 and 4.10 4GL running against 5.XX >engines. Feature creep is a real problem for me. I really like the BEFORE >MENU, HIDE OPTION, and SHOW OPTION available in 4.10 4GL, but when I tried >to port an application containing them to a system still running 4.00, it >died big time. These features are documented only in the 4.1 Supplement in the "4.1 Enhanced Statements" section. Was it unclear that these features were 4.1-specific? >See you at the user group meeting, >-Alan -- Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland Disclaimer: Poster under influence of 1,3,7-trimethylxanthine "Fall not in love; it will stick to your face." -- Deteriorata