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 > Other > Ingres 2006 Update Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-09, 11:08
Polly013 Polly013 is offline
Registered User
 
Join Date: Aug 2004
Location: Manchester, UK
Posts: 136
Ingres 2006 Update Error

Hi all,

I am attempting to run an update statement in Ingres 2006 to update a number of records. When I run the nested select I get 150 records, but when I run the update it changes 5600 records!!! Can anyone spot where I am going wrong with this command. I just can't see how it can be updating more than I ask it to.

Code:
update hbincome                                                            
     set inc_type = ''                                                          
     where claim_id in (select a.claim_id                                       
     from hbhousehold a, hbincome b                                             
     where a.claim_id = b.claim_id                                              
     and a.house_id = b.house_id                                                
     and a.to_date = '31.12.2099'                                               
     and b.inc_code in ('IBH','IBN','IBL','DLL','DLA','DLH')                    
     and b.inc_type in ('18','19','HL','HR'));
Many thanks,
Paula
Reply With Quote
  #2 (permalink)  
Old 07-07-09, 12:18
JF.pt JF.pt is offline
Registered User
 
Join Date: Jul 2009
Posts: 4
I Polly013,

try a select distinct, because if the select returns duplicated rows, it may have this behavior.

update hbincome
set inc_type = ''
where claim_id in (select distinct a.claim_id
from hbhousehold a, hbincome b
where a.claim_id = b.claim_id
and a.house_id = b.house_id
and a.to_date = '31.12.2099'
and b.inc_code in ('IBH','IBN','IBL','DLL','DLA','DLH')
and b.inc_type in ('18','19','HL','HR'));
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