pentaho - Simulating For inside For in SQL -


I am using HTT Vortica 7 as a data warehouse dB

I have to update two tables at the same time.

  foreach (line r in table_1) {foreach (line r2 in table 2) {if (r.key1 == r2.key1 & amp; r.key2 == r2 .key2and ; R.soldQuantity & gt; r2.quantity) {updateRowInT1 (); // R. Partner = R2. Partner; UpdateRowInT2 (); //r2.Quantity = r2.Quantity - r.soldQuantity; break; }}}  

This part of the code best describes what I should do. Is there a way in SQL to do this (with user-defined work) due to changes in the second table, can not I use the update and be included in it or can I?

In addition, this is part of the process of ETL by Pattah Kettle, maybe this is the way to do this tool.

Thanks

Edit: I have changed the code above.

What do I need to achieve?

Regular sales by partner.

What's wrong now?

When some SKUs are sold in a retail shop, then I can see the final partner of SKU. But, the company I work for is buying a single SKU from more partners. The gradually changing dimension does not apply because when we switch partners on the SKU, even then there is some amount of screw u on the shelf.

Perception:

FIFA - Firstly at the first out.

So, for the initial match, I need to compare the sales (date) and reduce the quantity purchased. Class = "post-text" itemprop = "text">

You probably should think of a more set-oriented approach.

Say I believe what you are trying to do properly, I will do it in two update statements:

  - A line in Table 2 Update Table_1's Partner by Table_1 R Set Partner = r2.Partner table_2 r2 from ou r2.key1 = r.key1 and r2.key2 = r.key2; - Decrease quantity in Table 2 based on the quantity sold in Table_1 Table 2 R2 SET volume = r2 Volume - r.soldQuantity to table_1 r WHERE r.key1 = r2.key1 and r.key2 = r2.key2 and r2.Quantity & gt; = R.soldQuantity; - Both of these should be done in the transaction so that it is not all or anybody else. COMMIT to share the work;  

You can see SQLFiddle.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -