<?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 Re: UPDATE JOIN SQL statement with JMP tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/287977#M55521</link>
    <description>&lt;P&gt;I'm not sure if JMP understands SQL related to UPDATE queries, based on this statement failing with "Query failed: table t1 may not be modified in access or evaluation..." I'm not sure this is possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Query(
	Table( dt1, "t1" ),
	"UPDATE t1 SET age = 10"
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can, however, do this with Update:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 &amp;lt;&amp;lt; Update(
	With( dt2 ),
	Match Columns( :name = :name ),
	Replace columns in main table(:age)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you have a more complex sql statement, you could create a SELECT query first using SQL to create a new table, then use this update function to update your original table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Aug 2020 13:47:06 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2020-08-25T13:47:06Z</dc:date>
    <item>
      <title>UPDATE JOIN SQL statement with JMP tables</title>
      <link>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/287946#M55517</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to update via SQL statement the :age column in dt1 with the values of dt2.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = Open( "$SAMPLE_DATA/Big Class.jmp", output table("t1"));
dt2 = subset(dt1);
dt2:age[1] = 99;

Query(
	Table( dt1, "t1" ),
	Table( dt2, "t2" ),
	"\[
		UPDATE t1
		SET 
			t1.age = t2.age
		FROM
			t1
		INNER JOIN 
			t2 
		ON 
			t1.name = t2.name
		
	]\"
);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got an syntax error near "."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:18:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/287946#M55517</guid>
      <dc:creator>TWE</dc:creator>
      <dc:date>2023-06-10T23:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE JOIN SQL statement with JMP tables</title>
      <link>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/287977#M55521</link>
      <description>&lt;P&gt;I'm not sure if JMP understands SQL related to UPDATE queries, based on this statement failing with "Query failed: table t1 may not be modified in access or evaluation..." I'm not sure this is possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Query(
	Table( dt1, "t1" ),
	"UPDATE t1 SET age = 10"
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can, however, do this with Update:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 &amp;lt;&amp;lt; Update(
	With( dt2 ),
	Match Columns( :name = :name ),
	Replace columns in main table(:age)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you have a more complex sql statement, you could create a SELECT query first using SQL to create a new table, then use this update function to update your original table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 13:47:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/287977#M55521</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2020-08-25T13:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: UPDATE JOIN SQL statement with JMP tables</title>
      <link>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/295632#M55708</link>
      <description>&lt;P&gt;This works.&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 06:23:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/UPDATE-JOIN-SQL-statement-with-JMP-tables/m-p/295632#M55708</guid>
      <dc:creator>TWE</dc:creator>
      <dc:date>2020-08-31T06:23:54Z</dc:date>
    </item>
  </channel>
</rss>

