Solved

MS Access Sql Queto associate values from different rows

Posted on 2016-09-15
3
68 Views
Last Modified: 2016-09-26
Experts,

I'm converting Payroll data from our old system to a new one. In the old system, when an employee moved to a new state, the State tax was recorded in the new state, but the YTD State Tax balance from the old state was coded as Previous State YTD tax (PRVST). In the new system, I need to map the PRVST to the state that the YTD balance was actually in, so in this case, to ST1MD


Old System                                                                                     Maps To in New System:
DateEnd           EmpID     Tax Code        Curr Tax    YTD Tax      Tax Code
8/31/2015        05961        ST1MD           $500        $3500            MD
9/15/2015        05961        ST1VA             $500        $ 500             VA  
9/15/2015        05961        PRVST                  $0       $3500            MD (How do I associate this $3500 with MD?)

Attached is some example data. There's about 870,000 lines on this table, but I think there are only about 250 PRVST codes

Thanks in advance
EE-Question-PRVST.xlsx
0
Comment
Question by:Ron
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
John Tsioumpris earned 500 total points
ID: 41801209
Well i have some kind of solution but i am not sure if this what you want.
Take a look at the attached accdb(zipped) -- Access 2013...if you have earlier version tell me to convert it.
I have imported your sheet. and then i have found the entries where previous tax is 0 and the amount of current tax(probably i am wrong about the definitions)
Then i get the entry from the previous state according to the amount and finally i update the data to fill with the previous state---> take a look at table FinalTest....
Database5.zip
0
 

Author Comment

by:Ron
ID: 41806481
That works. Thanks
0
 

Author Closing Comment

by:Ron
ID: 41816690
thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question