Dear Micha,

On Wed, Jun 17, 2020 at 4:05 PM Micha Silver <[email protected]> wrote:

>
> On 17/06/2020 16:14, Margherita Di Leo wrote:
>
> Ciao Stefan,
>
> thank you, I tried and it didn't give me any error but didn't update the
> column either...
>
>
>
> The sqlite CASE statement should be:
>
> CASE <old_column> WHEN '<old_val1>' THEN '<new_val1>' WHEN '<old_val2>'
> THEN '<new_val2>'....END;
>
>
> Here's an example that worked for me. I have a "myroads" vector with
> column 'TYPE'
>
>
> # Add new column for road width as text
>
> v.db.addcolumn myroads column="width TEXT"
>
> # Run update with CASE
>
> db.execute sql="UPDATE myroads SET width=CASE TYPE WHEN 'Main' THEN 'Wide'
> WHEN 'Local' THEN 'Narrow' ELSE 'Unknown' END;"
>
>
> Best, Micha
>
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?

Thanks!


-- 
Margherita Di Leo
_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to