## Message Posted: Tue, 21 Jan 2003 @ 23:25:42 GMT

 < Last>>

 Subj: Re: Question on the use of a stored procedure From: Dwight Etheridge

Set solution, having to make my own test data:

```drop table frank;
ct frank
(c1 char(1)
, c2 date
, c3 dec(5,2));

ins frank values( 'a',date, -10.12);
ins frank values( 'a',date, -9.12);
ins frank values( 'a',date, -8.12);
ins frank values( 'a',date, -7.12); /* <-- should pick this one */
ins frank values( 'a',date-1, -10.12);
ins frank values( 'a',date-1, -0); /* <-- should pick this one */
ins frank values( 'a',date-1, -9.82);
ins frank values( 'a',date-1,  10.12);

/* routine */

ins blah_table
sel  f.*
from frank f
QUALIFY csum(1, c2 desc, (case when c3=0 then 1 /* zero numbers = 1 */
when c3<0 then 2 /* neg numbers = 2  */
when c3>0 then 3 /* pos numbers = 3  */
end   )  asc, abs(c3) asc ) = 1

group by c1,c2

where c3 <= 0 ;
```

--
Dwight Etheridge

 < Last>>

Attachments

Library

Quick Reference

Archives

Sample Index

 2016 2007 2015 2006 2014 2005 2013 2004 2012 2003 2011 2002 2010 2001 2009 2000 2008 1999

2003 Indexes

 Jan Jul Feb Aug Mar Sep Apr Oct May Nov Jun Dec

 Top Home Privacy Feedback