Thank you Michael, that works.
Pete

On Thu, Apr 5, 2012 at 9:00 AM, <sqlite-users-requ...@sqlite.org> wrote:

> Message: 17
> Date: Thu, 5 Apr 2012 12:31:58 +0000
> From: "Black, Michael (IS)" <michael.bla...@ngc.com>
> To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
> Subject: Re: [sqlite] Variation on INSERT with SELECT issue
> Message-ID: <56DF5186-D679-4E16-9CF2-8CFAF0036CFD@mimectl>
> Content-Type: text/plain; charset="iso-8859-1"
>
> You need 2 inserts to do what you want.  Hopefully the order in the table
> doesn't matter to you.
>
>
>
> sqlite> CREATE TABLE t2 (Col1 text,Col2 text);
> sqlite> insert into t2 (Col1) values('xxx');
> sqlite> insert into t2 values('yyy','def');
> sqlite> select * from t2;
> xxx|
> yyy|def
> sqlite>
> sqlite>
> sqlite> CREATE TABLE t3 (Col1 text,Col2 text default 'abc');
> sqlite> insert into t3 SELECT * FROM t2 where Col2 is not null;
> sqlite> select * from t3;
> yyy|def
> sqlite> insert into t3 (Col1) SELECT Col1 FROM t2 where Col2 is null;
> sqlite> select * from t3;
> yyy|def
> xxx|abc
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> Advanced Analytics Directorate
>
> Advanced GEOINT Solutions Operating Unit
>
> Northrop Grumman Information Systems
>



-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to