On Thu, Apr 17, 2008 at 3:15 PM, Alex Katebi <[EMAIL PROTECTED]> wrote:

> I will give a simple example:
>
> create table t1(name);
> insert into t1('Alex');
> begin;
> insert into t1 values ('Dennis');
> select * from t1;
>
> The above will show two rows. How can I see only the 'Dennis' row in this
> simple example.
>

Here's one possibility:

sqlite> CREATE TABLE t1(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT);
sqlite> INSERT INTO t1(name) VALUES ('Alex');
sqlite> BEGIN;
sqlite> CREATE TEMPORARY TABLE start AS
   ...>   SELECT COALESCE(MAX(id), 0) AS v FROM t1;
sqlite> INSERT INTO t1(name) VALUES ('Dennis');
sqlite> SELECT name FROM t1 WHERE id > (SELECT v FROM start);
 name = Dennis
sqlite>

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

Reply via email to