<?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 with like condition in MySql in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333162#M101975</link>
    <description>&lt;P&gt;The easiest way to do this would be to use a tMySqlRow component and write the UPDATE statement yourself. Lets say you have a component with the following columns feeding into the tMySqlRow....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;row1.column1&lt;/P&gt;
&lt;P&gt;row1.column2&lt;/P&gt;
&lt;P&gt;row1.column3&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;row1.column4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;row1.column5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(These are all Strings for ease of explanation).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your tMySqlRow you can write the following query to carry out the update with the LIKE ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"UPDATE table1 SET COL1='"+row1.column1+"', COL2='"+row1.column2+"' WHERE COL1='"+row1.column3+"' AND COL2='"+row1.column4+"' AND COL3 like '%"+row1.column5+"%'"&lt;/PRE&gt;
&lt;P&gt;Take note that this is a bit of Java to build an UPDATE statement. The Talend columns are supplied as variables to the rest of literal String. Note the single quotes I have wrapped around the Talend column values. This is because in my example I am assuming them all to be Strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should note that I have literally just written this off the top of my head and have not checked it. But this method will work as long as you build legitimate SQL.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Nov 2017 10:09:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-16T10:09:49Z</dc:date>
    <item>
      <title>Update with like condition in MySql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333161#M101974</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I would like to execute the following query, in MySql database:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;FONT color="#000000"&gt;UPDATE table1 SET &lt;FONT color="#0000FF"&gt;COL1=new_data_1&lt;/FONT&gt;, COL2=new_data_2 WHERE&lt;/FONT&gt; &lt;FONT color="#0000FF"&gt;COL1=old_data_1&lt;/FONT&gt;&lt;FONT color="#000000"&gt; AND COL2=old_data_2 AND&lt;/FONT&gt; &lt;FONT color="#339966"&gt;COL3 like '%-data_3-%';&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have several requests upstream that allow me to obtain the necessary data.&lt;BR /&gt;I dont't know&lt;BR /&gt;- how to implement the "like" condition&lt;BR /&gt;- how to update the same data of the "where" condition (&lt;FONT color="#0000FF"&gt;&lt;EM&gt;set COL1 =... WHERE COL1=...&lt;/EM&gt;&lt;/FONT&gt;)&lt;BR /&gt;&lt;BR /&gt;how could I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 09:09:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333161#M101974</guid>
      <dc:creator>Virginie2905</dc:creator>
      <dc:date>2017-11-16T09:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Update with like condition in MySql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333162#M101975</link>
      <description>&lt;P&gt;The easiest way to do this would be to use a tMySqlRow component and write the UPDATE statement yourself. Lets say you have a component with the following columns feeding into the tMySqlRow....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;row1.column1&lt;/P&gt;
&lt;P&gt;row1.column2&lt;/P&gt;
&lt;P&gt;row1.column3&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;row1.column4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;row1.column5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(These are all Strings for ease of explanation).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your tMySqlRow you can write the following query to carry out the update with the LIKE ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"UPDATE table1 SET COL1='"+row1.column1+"', COL2='"+row1.column2+"' WHERE COL1='"+row1.column3+"' AND COL2='"+row1.column4+"' AND COL3 like '%"+row1.column5+"%'"&lt;/PRE&gt;
&lt;P&gt;Take note that this is a bit of Java to build an UPDATE statement. The Talend columns are supplied as variables to the rest of literal String. Note the single quotes I have wrapped around the Talend column values. This is because in my example I am assuming them all to be Strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should note that I have literally just written this off the top of my head and have not checked it. But this method will work as long as you build legitimate SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 10:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333162#M101975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-16T10:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update with like condition in MySql</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333163#M101976</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;that's what I started to put in place, your answer confirmed it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 16:15:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Update-with-like-condition-in-MySql/m-p/2333163#M101976</guid>
      <dc:creator>Virginie2905</dc:creator>
      <dc:date>2017-12-07T16:15:54Z</dc:date>
    </item>
  </channel>
</rss>

