<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Nested SQL in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597659#M92044</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 25.0.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi I am trying add the value from Table 1 column &lt;STRONG&gt;slprice &lt;/STRONG&gt;to another table Table 2 column &lt;STRONG&gt;slprice1 &lt;/STRONG&gt;using one line of SQL. I have tried using nested SQL, but all fails. The only code that works is with a for loop which I tried to avoid. Any suggestion?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="fr-img-caption fr-fic fr-dib" style="width: 302px;"&gt;&lt;SPAN class="fr-img-wrap"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1743670039633.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527120i7B7BC0A69D36875E/image-size/large?v=v2&amp;amp;px=999" role="button" title="1743670039633.png" alt="1743670039633.png" /&gt;&lt;/span&gt;&lt;SPAN class="fr-inner"&gt;Table 1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="fr-img-caption fr-fic fr-dib" style="width: 302px;"&gt;&lt;SPAN class="fr-img-wrap"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1743670079973.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527121iCC9968F5BBCEEBF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1743670079973.png" alt="1743670079973.png" /&gt;&lt;/span&gt;&lt;SPAN class="fr-inner"&gt;Table 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Table result = Table.query("UPDATE Test3 SET slprice1 = (SELECT slprice FROM Test2 WHERE Test3.ROW_NUMBER=Test2.ROW_NUMBER)"); //Nested SQL&lt;/PRE&gt;&lt;PRE&gt;Table result = Table.query("SELECT slprice FROM Test2");
for (int j=1; j&amp;lt;=result.numRows; j++)
{
Table result1 = Table.query("UPDATE Test3 SET slprice1= $1",result&lt;J&gt;["slprice"]);
}&lt;/J&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 03 Apr 2025 08:52:49 GMT</pubDate>
    <dc:creator>chanykE2WUT</dc:creator>
    <dc:date>2025-04-03T08:52:49Z</dc:date>
    <item>
      <title>Nested SQL</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597659#M92044</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 25.0.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi I am trying add the value from Table 1 column &lt;STRONG&gt;slprice &lt;/STRONG&gt;to another table Table 2 column &lt;STRONG&gt;slprice1 &lt;/STRONG&gt;using one line of SQL. I have tried using nested SQL, but all fails. The only code that works is with a for loop which I tried to avoid. Any suggestion?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="fr-img-caption fr-fic fr-dib" style="width: 302px;"&gt;&lt;SPAN class="fr-img-wrap"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1743670039633.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527120i7B7BC0A69D36875E/image-size/large?v=v2&amp;amp;px=999" role="button" title="1743670039633.png" alt="1743670039633.png" /&gt;&lt;/span&gt;&lt;SPAN class="fr-inner"&gt;Table 1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="fr-img-caption fr-fic fr-dib" style="width: 302px;"&gt;&lt;SPAN class="fr-img-wrap"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1743670079973.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527121iCC9968F5BBCEEBF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1743670079973.png" alt="1743670079973.png" /&gt;&lt;/span&gt;&lt;SPAN class="fr-inner"&gt;Table 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Table result = Table.query("UPDATE Test3 SET slprice1 = (SELECT slprice FROM Test2 WHERE Test3.ROW_NUMBER=Test2.ROW_NUMBER)"); //Nested SQL&lt;/PRE&gt;&lt;PRE&gt;Table result = Table.query("SELECT slprice FROM Test2");
for (int j=1; j&amp;lt;=result.numRows; j++)
{
Table result1 = Table.query("UPDATE Test3 SET slprice1= $1",result&lt;J&gt;["slprice"]);
}&lt;/J&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Apr 2025 08:52:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597659#M92044</guid>
      <dc:creator>chanykE2WUT</dc:creator>
      <dc:date>2025-04-03T08:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SQL</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597660#M92045</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;The MySQL syntax from the link below works. (Square brackets not strictly necessary)&lt;/P&gt;&lt;P&gt;&lt;A id="isPasted" href="https://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match"&gt;https://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;Table.query("UPDATE [Test3], [Test2] SET [Test3].[slprice1] = [Test2].[slprice] WHERE [Test3].[ROW_NUMBER] = [Test2].[ROW_NUMBER]")&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Apr 2025 11:13:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597660#M92045</guid>
      <dc:creator>FelixMoehlmann</dc:creator>
      <dc:date>2025-04-03T11:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SQL</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597661#M92046</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/19365/felixmh.html" nodeid="19365"&gt;@Felix Möhlmann&lt;/A&gt; Thanks&lt;P&gt;David&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 04 Apr 2025 01:46:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/nested-sql/m-p/13597661#M92046</guid>
      <dc:creator>chanykE2WUT</dc:creator>
      <dc:date>2025-04-04T01:46:50Z</dc:date>
    </item>
  </channel>
</rss>

