473,395 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Removing a record from resultset using SQL

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.
Jun 20 '07 #1
1 1265
r035198x
13,262 8TB
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.
Please don't double post .
Jun 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: eeh | last post by:
Hi, Suppose I have a table "product" with fields id,name,price. I want to get a resultset of previous and current and next record when the resultset is sorted by id and id=10. The table data is...
7
by: Agnes | last post by:
In my store procedure , i will select * from myTable, and I will while-loop the result by using datareader in vb.net . Now, Can I know the number of records before I while-loop the resut ??
26
by: Jimmy | last post by:
ill have a database with 1 table and 3 fields: ID FIRSTNAME LASTNAME (the ID field will be the auto incrementing index) there might be 10 records in the DB, there might be 10,000. i...
0
by: David Linsin | last post by:
I created a simple test case to reproduce the problem (also check Bug #15500): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.