English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hey everyone!
Here's what I am doing:
in Databse1 I have item_tbl and itemfile_tbl
item_tbl has 30,000 rows of ID number and a price
itemfile_tbl has 4 rows of ID number and price

I need to update item_tbl with the four rows from itemfile_tbl... I use the following query...

update item_tbl
set sell_price=(select itemfile_tbl.sell_price/100
from itemfile_tbl
where itemfile_tbl.item_id = item_tbl.item_id)
where exists
(select itemfile_tbl.sell_price
from itemfile_tbl
where itemfile_tbl.item_id = item_tbl.item_id
AND
itemfile_tbl.sell_price/100<>item_tbl.sell_price)


My problem is that it takes 10seconds per item to update!
in all reality I will eventually have to update almost all 30,000 rows, but I'm using the 4 as my test data.
This means it will take a VERY long time (~70 hours)

Am I doing something wrong?? Please help, Thanks!

- Jason

2007-03-05 10:20:37 · 2 answers · asked by Jason 2 in Computers & Internet Programming & Design

I am using a DB2 database

2007-03-05 12:38:32 · update #1

2 answers

I think you need a join statement from the smaller file to the larger one using the id_number. Are you using Access?

2007-03-05 10:38:18 · answer #1 · answered by Michael D 2 · 0 0

Jason

Just change your WHERE thing, so more than one row is specified in the query

Good luck and Happy Computing

2007-03-05 18:27:04 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers