HowTp Question:Append vs Update

P

Phil Smith

I know this has to come up a lot, and I am wondering the best way to
handle it.

I have two tables in a one to many relationship. Say an Product table,
and a price table, which will have as many as ten different prices.

I want to make sure that all items have a "Senior Discount price" of 10%
over product.cost.

The problem is that some of these products will have a "Senior Discount"
of some value, which of course I want to change to 10%, and other
products will not have a 'Senior Discount" price. What is the fastest
way to both update the existing prices, and add new prices where neccessary?
 
P

pietlinden

I know this has to come up a lot, and I am wondering the best way to
handle it.

I have two tables in a one to many relationship.  Say an Product table,
and a price table, which will have as many as ten different prices.

I want to make sure that all items have a "Senior Discount price" of 10%
over product.cost.

The problem is that some of these products will have a "Senior Discount"
of some value, which of course I want to change to 10%, and other
products will not have a 'Senior Discount" price.  What is the fastest
way to both update the existing prices, and add new prices where neccessary?

I guess you have to store the new price because it's essentially a new
fact... one of the few exceptions to the "do not store derived data"
rules. I would run the update query first, and then turn the result
of the find unmatched query wizard into an append query. Then you
could just run the two queries in sequence.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL Language 2
XPath 2
Verify data via query 1
Help with Query for new user 4
Build "between" parameter query programatically 2
Need To Automate Task 1
Counting Missing values in a specific field. 1
SQL Update 14

Top