<div dir="ltr">Super! Thank you both!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 17, 2020 at 9:12 PM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<br>
<div>On 17/06/2020 19:38, Margherita Di Leo
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">Dear Micha,<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jun 17, 2020 at 4:05
PM Micha Silver <<a href="mailto:tsvibar@gmail.com" target="_blank">tsvibar@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> <br>
<div>On 17/06/2020 16:14, Margherita Di Leo wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Ciao Stefan,</div>
<div><br>
</div>
<div>thank you, I tried and it didn't give me any
error but didn't update the column either...<br>
</div>
</div>
<br>
</blockquote>
<p><br>
</p>
<p><br>
</p>
<p>The sqlite CASE statement should be:</p>
<p>CASE <old_column> WHEN '<old_val1>' THEN
'<new_val1>' WHEN '<old_val2>' THEN
'<new_val2>'....END;</p>
<p><br>
</p>
<p>Here's an example that worked for me. I have a
"myroads" vector with column 'TYPE'</p>
<p><br>
</p>
<p><font size="+1"><tt># Add new column for road width as
text</tt><tt><br>
</tt></font></p>
<p><font size="+1"><tt>v.db.addcolumn myroads
column="width TEXT"</tt></font></p>
<p><font size="+1"><tt># Run update with CASE</tt></font></p>
<p><font size="+1"><tt>db.execute sql="UPDATE myroads SET
width=CASE TYPE WHEN 'Main' THEN 'Wide' WHEN 'Local'
THEN 'Narrow' ELSE 'Unknown' END;"</tt></font></p>
<p><font size="+1"><tt><br>
</tt></font></p>
<p><font size="+1">Best, Micha</font><font size="+1"><tt><br>
</tt></font></p>
</div>
</blockquote>
<div>This worked! Thank you so much! I have one last question.
Does it also support an IS LIKE condition, and if yes, how
can I express it?</div>
<div><br>
</div>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Yes, sqlite supports LIKE, for example:</p>
<p><br>
</p>
<p>micha@tp480:scripts$ db.select sql='SELECT TYPE,LENGTH FROM roads
WHERE TYPE LIKE "%Ma%";' <br>
TYPE|LENGTH<br>
Main|1.542641<br>
Main|4.346567<br>
Main|1.382557<br>
Main|1.120805<br>
Main|1.117633<br>
Main|0.13777<br>
....</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div>Thanks!<br>
</div>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><font color="#666666">Margherita Di Leo</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<pre cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
<a href="https://orcid.org/0000-0002-1128-1325" target="_blank">https://orcid.org/0000-0002-1128-1325</a></pre>
</div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font color="#666666">Margherita Di Leo</font></div></div></div></div></div></div></div></div></div>