Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

For each SQL query

0 Kudos

We have a database that contains data no time like the present booked to projects. We have a live record for a venture, that holds the right time data (imported from SAP one time per week). We additionally have filed records showing the time data at a point on schedule, these are required one time per week, basically, they are previews. It is workable for clients to later place in a solicitation to change the time on the project.

In the event that this occurs, the live record will mirror the right ideal opportunity for the task, but the previews will not. I need to compose an inquiry that goes through and refreshes these depictions with the right ideal opportunity for the task, by then. We have a table of SAP data, that has records for each time passage for a venture, showing the undertaking code it was for, the date it was for, and the measure of time. The Historical data table contains the code for the venture and the date the depiction was taken.

So I need to compose a SQL question that will go through the chronicled data table and for each line update the time spent by taking a gander at the SAP table and getting untouched entry, for that venture code, before the date that depiction was taken. I'm having genuine trouble doing this in one SQL inquiry, the principal issue being I truly need to run a question for each record in the authentic data table. I keep concocting pages proposing utilizing cursors, however, I don't think a lot about them and continue seeing articles saying they are awful. Any ideas on what kind of inquiry I can use to get in transit with this would be incredible! Basically, I'm learning how to write pseudocode is:

For Each Project Code in the hostorical data table, archived on a date, select all time entrys on or before that date.

Sample tables

Historical Project Data                          SAP Data
-----------------------                        ----------------
Project Code | run date                        Project Code | Time | Date
1234         | 01/09/2009                      1234         | 2    | 29/08/2009
9876         | 01/09/2009                      1234         | 5    | 29/08/2009
1234         | 07/09/2009                      9876         | 10   | 02/09/2009
9876         | 07/09/2009                      1234         | 2    | 03/09/2009

Help me out...

  • SAP Managed Tags:
1 REPLY 1

former_member763929
Participant

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with Community Q&A , as the overview provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your Profileyou encourage readers to respond.

  • SAP Managed Tags: