Thanks everyone for your help....finally got it working.
very simple answer and trivial but took me hours to look for this online and I 
still dont see this answer online but here it is for anyone who may be a newbie 
like myself....

sqlite3 db1 "attach ARGS1_DB as db1; select * from args"






--- On Sun, 3/14/10, P Kishor <punk.k...@gmail.com> wrote:

> From: P Kishor <punk.k...@gmail.com>
> Subject: Re: [sqlite] syntax for sqlite to query across 2 databases
> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
> Date: Sunday, March 14, 2010, 10:35 PM
> Perhaps you should start by telling
> *all* your sqlite issues. That
> would make for more efficient help being provided. See more
> below --
> 
> 
> On Sun, Mar 14, 2010 at 8:21 PM, David Lyon <david_ly...@yahoo.com>
> wrote:
> > I tried getting ATTACH to work since this am (EST) and
> have been looking in the different sqlite forums but have
> yet to find a simple and clear description of how to get
> this to work.
> >
> > I have the ARGS1_DB and contains args table. when I
> attach the ARGS1_DB to db1, I dont get the args table from
> ARGS1_DB in db1. any ideas?
> >
> > Apologies for the inconvenience.
> >
> >
> > sqlite3   ARGS1_DB  "select * from args" | more
> > 1|1
> > 2|2
> > 3|3
> > 4|4
> > 5|5
> > 6|6
> > 7|7
> > 8|8
> >
> > sqlite3 db1 "attach ARGS1_DB as db1"
> >
> 
> Think of how sqlite3 works. The way you are working with
> it, you are
> running a command, ostensibly from the command line, and
> then that
> command is done, fini. Now, think of the above command. The
> ATTACH sql
> command is run and then sqlite3 quits. Its work is done.
> Anything you
> do further, like the commands below, are not longer going
> to be
> affected by the ATTACH command above.
> 
> > sqlite3 db1 "select * from args"
> > SQL error: no such table: args
> >
> >  sqlite3 db1 "select * from db1.args"
> > SQL error: no such table: db1.args
> >
> >
> 
> Assuming you are working from the sqlite3 shell (again,
> since you
> haven't given any information how you are working with your
> db, I am
> not even sure you are aware of the sqlite3 shell), from
> your
> computer's shell command line
> 
> $ sqlite3 db1
> SQLite version 3.6.19
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> CREATE TABLE t1 (id INTEGER PRIMARY KEY, a
> TEXT);
> sqlite> INSERT INTO t1 (a) VALUES ('blah');
> sqlite> SELECT * FROM t1;
> id          a
> ----------  ----------
> 1           blah
> sqlite> .q
> $ ls
> db1
> $ sqlite3 db2
> SQLite version 3.6.19
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> CREATE TABLE t2 (id INTEGER PRIMARY KEY, b
> TEXT);
> sqlite> INSERT INTO t2 (b) VALUES ('meh');
> sqlite> SELECT * FROM t2;
> id          b
> ----------  ----------
> 1           meh
> sqlite> .q
> $ ls
> db1    db2
> $sqlite3 db1
> SQLite version 3.6.19
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> ATTACH DATABASE db2 AS db2;
> sqlite> SELECT t1.a, t2.b FROM t1 JOIN t2 ON t1.id =
> t2.id;
> a           b
> ----------  ----------
> blah        meh
> sqlite>
> 
> Hope that helps.
> 
> 
> 
> 
> 
> >
> >
> > --- On Sun, 3/14/10, Jay A. Kreibich <j...@kreibi.ch>
> wrote:
> >
> >> From: Jay A. Kreibich <j...@kreibi.ch>
> >> Subject: Re: [sqlite] syntax for sqlite to query
> across 2 databases
> >> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
> >> Date: Sunday, March 14, 2010, 9:37 PM
> >> On Sun, Mar 14, 2010 at 06:22:15PM
> >> -0700, David Lyon scratched on the wall:
> >>
> >> > Can you or someone provide the exact syntax
> for ATTACH
> >>
> >>
> >>
> >>   http://www.lmgtfy.com/?q=sqlite+attach+command&l=1
> >>
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> 
> 
> 
> -- 
> Puneet Kishor http://www.punkish.org
> Carbon Model http://carbonmodel.org
> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
> Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
> Nelson Institute, UW-Madison http://www.nelson.wisc.edu
> -----------------------------------------------------------------------
> Assertions are politics; backing up assertions with
> evidence is science
> =======================================================================
> _______________________________________________
> 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

Reply via email to