| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

07-14-04, 15:04
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 24
|
|
|
Find the first occurance of zero
|
|
Hi,
prod ac rate fundg fee pch_upb upb eff_qtr
upb_qtr
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 1151445.52,2002Q4, 2002Q2
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 0, 2002Q4, 2002Q3
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 0, 2002Q4, 2002Q4
I have a table test
which has 9 columns prod, ac, rate, fund etc
and has some records and at some point upb goes to zero(0) and I want to select the first occruance of zero.
If any one can let me know how to do this in DB2, that will be a great help.
Thanks in advance
Srinivas
__________________
Thanks
Srinivas chityala
|
|

07-14-04, 15:11
|
|
Registered User
|
|
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
|
|
Quote:
|
Originally Posted by oracle08821
Hi,
prod ac rate fundg fee pch_upb upb eff_qtr
upb_qtr
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 1151445.52,2002Q4, 2002Q2
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 0, 2002Q4, 2002Q3
OTHER, AFS, 0.0875, 2002Q2, 39960.39, 1656279.17, 0, 2002Q4, 2002Q4
I have a table test
which has 9 columns prod, ac, rate, fund etc
and has some records and at some point upb goes to zero(0) and I want to select the first occruance of zero.
If any one can let me know how to do this in DB2, that will be a great help.
Thanks in advance
Srinivas
|
SELECT... WHERE UPB=0... ORDER BY... FETCH FIRST ROW ONLY;
__________________
--
Jonathan Petruk
DB2 Database Consultant
|
|

07-14-04, 15:45
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 24
|
|
|
|
Quote:
|
Originally Posted by J Petruk
SELECT... WHERE UPB=0... ORDER BY... FETCH FIRST ROW ONLY;
|
I want to get the all non zero upbs and first occurance of zero, table has more that 100 records.
Thanks
Srinivas
__________________
Thanks
Srinivas chityala
|
|

07-14-04, 19:08
|
|
Registered User
|
|
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
|
|
Quote:
|
Originally Posted by oracle08821
I want to get the all non zero upbs and first occurance of zero, table has more that 100 records.
Thanks
Srinivas
|
SELECT ... FROM ... WHERE upbs != 0
UNION
(SELECT ... FROM ... WHERE upbs = 0 ORDER BY <ORDER> fetch first row only);
__________________
--
Jonathan Petruk
DB2 Database Consultant
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|