SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


future product costs


future product costs

Author
Message
spin
spin
Mr or Mrs. 500
Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)Mr or Mrs. 500 (586 reputation)

Group: General Forum Members
Points: 586 Visits: 537
Hi

i am developing a small db which has the following requirement...

A product cost can be created for a future year/month. All transaction before that date use the current cost. All transaction after that date will use the new cost.

If i have my product table with a cost field in how do i create a table that uses the above rule? i.e. the cost will change based on future cost changes.

hope that makes sense.

Thanks
Amit Raut
Amit Raut
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1225 Visits: 342
A typical Price Master table would look like the one below:

Product ID--------Price------From Date-------To Date
P001-------------100-------1/1/2013---------12/31/2013
P001-------------150-------1/1/2014---------12/31/2014
P001-------------175-------1/1/2015---------

Your logic would pick up the Price based on the current date residing between From Date and To Date.
Attachments
PriceMaster.png (6 views, 2.00 KB)
Amit Raut
Amit Raut
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1225 Visits: 342
So with the current table you need to have two more columns From Date and To Date.

Else have a new table as Price Master as detailed above.

Let me know if this meets your requirements.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search