On 6/1/2011 5:23 PM, Jim Mellander wrote:
> I appreciate the help - I'm new at using triggers.  What I want to
> accomplish is:
>
> 1. insert if the ip isn't already in the database
> 2. update the timestamp if the new timestamp after the current
> timestamp in the database

Something like this, perhaps:

insert or replace into ip_timestamps values(:ip,
   max(:timestamp, coalesce((select timestamp from ip_timestamps where 
ip = :ip), 0))
);

No trigger needed.
-- 
Igor Tandetnik

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

Reply via email to