I have a table rhat have five columns( Version,Version Type,Version code, Submission_Date,submission). The data in the table looks like below:
Version, Version Type, Version code, Submission_Date, submission
SU13 PS FW -------- ------------- 3/13/2013 DP
SU13 PS FW -------- ------------- 2/13/2013 DP
SU14 CF AP ----------- -------------- 4/14/2014 DP
FA14 Planet ----------- -------------- 2/17/2012 Sales
SU14 Planet ----------- ------------- 3/3/2013 Sales
Fa14 Planet ----------= ------- 3/23/2014 Sales
FA14 SP1 --------------- ---------- 4/4/2014 Sales
FA14 SP1 Current --------------- ---------- 4/3/2014 Sales
FA14 SP1 Current --------------- ---------- 2/3/2014 Sales
This is a small data set from my database.The logic here is that all the data from version is inserted from one of the main table (A) on the database. So everytime there is a new data added I need to make sure that the Version get updated too. As for the -----------(Version Type) and ------------- version code logic here is what needs to be done.
For DP there can be three different file. If you see at the end of the version text there is AP,FW . These are two different files. So depending on the latest submission date thesse file needs to be marked as either Final, Previous,or Archive. For example "SU13 PS FW" has two submission date 3/13 and 2/13 of same year. So the last date it was updated which is 3/13 should be marked as final and the date befor than that should be previous. Anydate for those FW file for that season should be Archive.
Again for Sales (Submission) there can be different files like planet ,SP1,Sp2 etc. Depending on that file with the current date should be final ,previous or current.
If there are any file that says current then that should be updated as current with respective to submission date. If there is two current file then the file with the latest submission date should be currreent and the file with previous date should be all archive.
Also for version code:
Final= 01
Previous =02
Current =03
Archive =04
Below is what my table should look like.
Version, Version Type, Version code, Submission_Date, submission
SU13 PS FW Final 01 3/13/2013 DP
SU13 PS FW Previous 02 2/13/2013 DP
SU14 CF AP Final 01 4/14/2014 DP
FA14 Planet Previous 02 2/17/2012 Sales
SU14 Planet Final 01 3/3/2013 Sales
FA14 Planet Final 01 3/23/2014 Sales
FA14 SP1 Final 01 4/4/2014 Sales
FA14 SP1 Current Current 03 4/3/2014 Sales
FA14 SP1 Current Archive 04 2/3/2014 Sales
can someone help me to figure this out?
SPPandey