On 7/13/06, Christian Smith <[EMAIL PROTECTED]> wrote:
You can't use aggregate functions in WHERE clauses. Also, you can't use a
select as the value in an insert. You can insert from the results of an
insert.

uh...It seems to work:

SQLite version 3.0.8
Enter ".help" for instructions
sqlite> CREATE TABLE test
  ...>   (
  ...>     Id                INTEGER PRIMARY KEY,
  ...>     value             INTEGER
  ...>   );
sqlite>
sqlite> INSERT INTO test(value) VALUES(42);
sqlite> INSERT INTO test(value) VALUES(43);
sqlite> INSERT INTO test(value) VALUES(44);
sqlite> INSERT INTO test(value) VALUES(45);
sqlite>
sqlite> select * from test;
1|42
2|43
3|44
4|45
sqlite> select value + 10
  ...>  from test
  ...> where id = (select max(id) from test);
55
sqlite> insert into test( value )
  ...> select value + 10
  ...>  from test
  ...> where id = (select max(id) from test);
sqlite>
sqlite> select * from test;
1|42
2|43
3|44
4|45
5|55
sqlite>




--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

Reply via email to