On 11 May 2012, at 10:25am, YAN HONG YE <yanhong...@mpsa.com> wrote:

> INSERT INTO "t" VALUES(5,'7/1/2011');
> 
> DELETE FROM t WHERE rowid NOT IN (
> SELECT rowid FROM
>    ( SELECT rowid, num, date FROM t ) CROSS JOIN
>    ( SELECT num min_num, min( date ) min_date FROM t GROUP BY num ) ON
>    num=min_num AND date=min_date
> );

Warning: if you want to do things like 'min(date)' then do not store your dates 
in an order which can't be sorted.  If you want to store your dates as text, 
store them in order '2011/01/07'.  Otherwise store them as numbers.

> I want to run the bbb sql file in command ,how to write command in c or c++ 
> or console command line?

It depends which operating system you are running.  But you can use the shell 
tool, and tell it to execute the commands in your SQL text file.  See some 
examples near the bottom of this page:

<http://www.sqlite.org/sqlite.html>

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

Reply via email to