[GRASSLIST:8335] Re: db.execute syntax

Trevor Wiens twiens at interbaun.com
Mon Sep 19 12:09:21 EDT 2005


On Mon, 19 Sep 2005 12:12:36 -0300
"Patton, Eric" <epatton at nrcan.gc.ca> wrote:

> I'm having a bit of trouble getting my syntax right for this SQL statement.
> I want the query to read through all the cat values in the table, and enter
> the value "1" in an empty column wherever the cat value is divisible by 60
> with no remainder (cat % 60 == 0). Here's what I enetered:
>  
>  echo 'UPDATE Opil184a_ship_nav_med_smth SET MOD_60==1 WHERE (cat%60)==0'  |
> db.execute
>  
> I know there has to be something wrong with that WHERE clause, but my SQL's
> really bad.
>  
>  
> Any ideas?
>  
> ~ Eric.

Eric,

I noticed two things. First the use of double equal signs, use single equal signs. Second, you realize that if you cats with a value of zero, the will also be updated so you should use something like: 

echo 'UPDATE Opil184a_ship_nav_med_smth SET MOD_60 = 1 WHERE (cat%60) = 0 and cat <> 0'  | db.execute

T
-- 
Trevor Wiens
twiens at interbaun.com

The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
(Daniel J. Boorstin)




More information about the grass-user mailing list