Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2 SQL Reporting question!!

Status
Not open for further replies.

db2deep

IS-IT--Management
Nov 19, 2007
5
US
Hi -

I want to get the db2 SQL output of a query, WHERE B>=90 and wherever it find the matching condition it should fetch preceding 3 rows.

For Example -
A B
- -
1 5
0 6
5 8
1 10
2 20
3 30
4 98
5 50
11 55
6 60
7 70
8 90
9100

So the output should be based on above criteria -
A B
- -
1 10
2 20
3 30
4 98
11 55
6 60
7 70
8 90

Any help will be appreciated.

Thanks
Sandip
 
Sandip - you may have more luck posting the the DB2 forum here: forum178

Fee

The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top