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.

 
Go Back  dBforums > Database Server Software > DB2 > Removing selected rows from a dataset, like select distinct but not really

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-06, 00:32
donkz donkz is offline
Registered User
 
Join Date: May 2006
Posts: 1
Removing selected rows from a dataset, like select distinct but not really

Hi DB2 gurus, the DB2 version i'm using is 8.2.3.

I'm currently trying to remove unnecessary rows dynamically from a DB2 dataset. To illustrate, here's an example.

taking 3 columns say Group, Category and Value

In Group we have: Asset
In Category we have: Fixed, Non-Fixed, Depreciated (amogst others, they are about 50)
In Value would be the actual values, so in table form:

Asset Fixed 100
Non-Fixed 100
Depreciated 200

Now imagine that Fixed and Non-fixed are actually the same thing, someone entered the data twice under different Categories so the value is duplicated. Summing for Asset will give 400 when the actual sum should only be 100.

How can I use a select statement such that only Fixed or Non-Fixed will be selected without removing the Category column and summing. That means the final result will give

Asset Fixed 100
Depreciated 200

The final result should show Fixed or Non-Fixed (doesn't matter which but only 1 can be shown). I tried using select distinct but that actually select distinct rows which doesn't work for this case.

Any idea gurus? Your help is greatly appreciated.

Cheers.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On