[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] MAX() Query
Yeah,
But I am not certain loops=10 works with all platforms. I think that didn't
work with an implementation I was working on that had v8.43/8.44 tools and a
db2 database running on a mainframe.
peace,
clark 'the dragon' willis
PSA: Salary <> Slavery. If you earn a salary, your employer is renting your
services for 40 hours a week, not purchasing your soul. Your time is the
only real finite asset that you have, and once used it can never be
recovered, so don't waste it by giving it away.
"Time is the coin of your life. It is the only coin you have, and only you
can determine how it will be spent. Be careful lest you let other people
spend it for you."
Carl Sandburg
(1878 - 1967)
----Original Message Follows----
Or say "begin-select loops=10"
-----Original Message-----
Use the first one, and place an sqr counter in the select statement, then
have the select end when you get the 10th or last value.
peace,
clark 'the dragon' willis
----Original Message Follows----
I am trying to get the ten highest balance amounts from the db. None of
these queries do the job. Does anyone know how I can do this?
SELECT a.BAL_amt, A.CUST_ID, B.SEGMENT_ID, B.NAME1, C.BAL_TOTAL,
C.BAL_CURRENT
FROM PS_CUST_DATA A, PS_CUSTOMER B, PS_DAILY_AG_VW_L C
WHERE A.BUSINESS_UNIT = 'LATIS'
AND A.CUST_ID = B.CUST_ID
AND A.CUST_ID = C.CUST_ID
AND substr(B.SEGMENT_ID,1,1) NOT IN ('W','A')
AND rownum < 11
and a.BAL_amt <= (select max(bal_amt) from ps_cust_data)
order by a.bal_amt
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users