Re: [sqlite] Re trieve results of a query into a bash script, and use them to iterate

2009-03-16 Thread Ken

you might want to do a search on named pipes... 

Also you query could then be simplified.

attach database 'db2.sl3' as usr
select u.* from usr.user u, names n
where u.name = n.name




--- On Mon, 3/16/09, urschrei  wrote:

> From: urschrei 
> Subject: [sqlite] Re trieve results of a query into a bash script, and use 
> them to iterate
> To: sqlite-users@sqlite.org
> Date: Monday, March 16, 2009, 9:50 PM
> I'd like to use the results of a simple select query in
> a bash script, and
> iterate through them with a 'for' loop. I have
> something like the following
> in mind:
> 
> names = `sqlite3 db1.sl3 'select * from names;'`
> users = `sqlite3 db2.sl3 'select * from users;'`
> for n in names
> do
>  for u in users
>   do
>if $n == $u echo $u is a valid user!
>fi
>   done
> done
> 
> Am I on the right track, or should I be going about this
> differently?
> -- 
> View this message in context:
> http://www.nabble.com/Retrieve-results-of-a-query-into-a-bash-script%2C-and-use-them-to-iterate-tp22551722p22551722.html
> Sent from the SQLite mailing list archive at Nabble.com.
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Re trieve results of a query into a bash script, and use them to iterate

2009-03-16 Thread urschrei

I'd like to use the results of a simple select query in a bash script, and
iterate through them with a 'for' loop. I have something like the following
in mind:

names = `sqlite3 db1.sl3 'select * from names;'`
users = `sqlite3 db2.sl3 'select * from users;'`
for n in names
do
 for u in users
  do
   if $n == $u echo $u is a valid user!
   fi
  done
done

Am I on the right track, or should I be going about this differently?
-- 
View this message in context: 
http://www.nabble.com/Retrieve-results-of-a-query-into-a-bash-script%2C-and-use-them-to-iterate-tp22551722p22551722.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users