[GRASSLIST:5177] Re: db.select problem

grit grit.schuster at geographie.uni-freiburg.de
Thu Dec 16 10:03:21 EST 2004


Thanks Stephan!

this works fine using the grass prompt:

db.select table=corinelandcover sql='select * from corinelandcover
where BEREICH_NR=3 and GRUPPE_NR=31 and ART_NR=311'

echo "SELECT * FROM corinelandcover WHERE BEREICH_NR=3 AND GRUPPE_NR=31
AND ART_NR=311"|db.select




But, trying to run the same sql statement through the interactive db.select 
user interface does end with an error: 

db.select driver=dbf table=corinelandcover sql=echo"SELECT * FROM corinelandcover WHERE BEREICH_NR=3 AND GRUPPE_NR=31 AND ART_NR=311" fs=|| vs=-- nv=NULL
Sorry <*> is not a valid option
Sorry <FROM> is not a valid option
Sorry <corinelandcover> is not a valid option
Sorry <WHERE> is not a valid option
Sorry, <BEREICH_NR> is not a valid parameter
Sorry <AND> is not a valid option
Sorry, <GRUPPE_NR> is not a valid parameter
Sorry <AND> is not a valid option
Sorry, <ART_NR> is not a valid parameter

I tried to use the "input=filename" option with the same statement. But in this case all records
of the table are selected. 

I just don't understand it :-(

Grit








Stephan Holl wrote:

>Hello grit, 
>
>On Thu, 16 Dec 2004 14:10:58 +0100 grit
><grit.schuster at geographie.uni-freiburg.de> wrote:
>
>  
>
>>Hello,
>>
>>could anybody please give me an idea about what I'm doing wrong?
>>I'm running db.select on the grass prompt with
>>
>>db.select table=corinelandcover sql='select * from corinelandcover
>>where BEREICH_NR=3 and GRUPPE_NR=31 and ART_NR=311'
>>
>>
>>Running the same sql query on db.select interative the following lines
>>are printed:
>>
>>db.select driver=dbf table=corinelandcover sql='select * from 
>>corinelandcover where BEREICH_NR=3 and GRUPPE_NR=31 and ART_NR=311' 
>>fs=|| vs=-- nv=NULL input=/home/grit/sqlstatement
>>Sorry <*> is not a valid option
>>Sorry <from> is not a valid option
>>Sorry <corinelandcover> is not a valid option
>>Sorry <where> is not a valid option
>>Sorry, <BEREICH_NR> is not a valid parameter
>>Sorry <and> is not a valid option
>>Sorry, <GRUPPE_NR> is not a valid parameter
>>Sorry <and> is not a valid option
>>Sorry, <ART_NR> is not a valid parameter
>>    
>>
>
>Have you tried another syntax?
>
>This should do:
>echo "SELECT * FROM corinelandcover WHERE BEREICH_NR=3 AND GRUPPE_NR=31
>AND ART_NR=311"|db.select
>
>
>Make sure, that the table is existent in your location/mapset/dbf-folder
>
>Cheers
>	Stephan
>
>
>  
>




More information about the grass-user mailing list