Hi,
I am writing a SQL code in DB2 for a report. My problem is something like this :
there and event_id in a table.. that is having values in order 1,2,3,4,5 .. and so on .. if there is any event ids for a customer are 1 and 81 , I will have to show only 81th record and for 1, 91 .. I will have to show only 91th record and so on .. and if a particular customer is not having any even id in 8X or 9X series then I will have to show exact data ..
Here is an example :
Cust 1
event_id--City---State--- zip
1 -- abc --- def -- 22804
2 --------- xyz --- xab -- 22564
81 --------- abc -- hsh-- 22222
The expected output should be :
event_id--City---State--- zip
2 --------- xyz --- xab -- 22564
81 --------- abc -- hsh-- 22222
Cust 2
1 -- abc --- def -- 22804
2 --------- xyz --- xab -- 22564
The expected output should be :
event_id--City---State--- zip
1 -- abc --- def -- 22804
2 --------- xyz --- xab -- 22564
Please help me out in this how can I handle this using SQL.