Greetings and salutations!
Ok, the subject is obscure, so let me explain... I am already doing this programmatically, but, but I would like to have SQLite do it instead. Let us imagine the following table: CREATE TABLE PMTime (id integer primary key, rec integer, date, secs integer); sqlite> select * from PMTime; 3545|7086|2008-12-18|1800 3546|7163|2008-12-18|1800 3547|7164|2008-12-18|1800 3548|7165|2008-12-18|1800 3549|7166|2008-12-18|1800 3550|7167|2008-12-18|3600 3554|3920|2008-12-18|1800 3555|3920|2008-12-19|28800 3556|5180|2008-12-22|1800 3559|8015|2008-12-22|1800 3560|8017|2008-12-22|1800 3561|4172|2008-12-22|23400 3562|7582|2008-12-23|5400 3563|7581|2008-12-23|5400 3564|6610|2008-12-23|3600 3565|7426|2008-12-23|7200 3570|8069|2008-12-23|7200 3580|4172|2008-12-24|28800 3581|1101|2008-12-25|28800 3582|1101|2008-12-26|28800 3597|7840|2008-12-29|7200 3600|8069|2008-12-29|7200 3602|4172|2008-12-29|14400 3603|3920|2008-12-30|14400 3604|8136|2008-12-30|10800 3605|1241|2008-12-30|3600 3606|1241|2008-12-31|14400 3607|2133|2008-12-31|14400 3608|1101|2009-01-01|28800 3610|1265|2009-01-02|28800 3611|8182|2009-01-05|14400 3612|8183|2009-01-05|14400 3613|8142|2009-01-06|1800 3614|8141|2009-01-06|1800 3642|8244|2009-01-06|1800 3643|8261|2009-01-06|14400 3644|6975|2009-01-06|9000 3645|8244|2009-01-07|3600 3657|7144|2009-01-07|1800 3658|7145|2009-01-07|1800 3659|7146|2009-01-07|1800 3660|7151|2009-01-07|1800 3661|7152|2009-01-07|3600 3662|7153|2009-01-07|1800 3663|8182|2009-01-07|5400 3664|7154|2009-01-07|1800 3665|7155|2009-01-07|1800 3666|7027|2009-01-07|1800 3667|7183|2009-01-07|1800 3668|7184|2009-01-08|1800 3669|7185|2009-01-08|1800 3670|7186|2009-01-08|1800 3671|8261|2009-01-08|14400 3672|7037|2009-01-08|1800 3673|7194|2009-01-08|1800 3674|7195|2009-01-08|1800 3675|7193|2009-01-08|3600 3676|7196|2009-01-09|1800 3682|8183|2009-01-09|12600 3685|7311|2009-01-09|1800 sqlite> What the program does is to keep track that the secs will not add to more than 28800 for any date. If it does, a new PMTime record is added with the rest of the secs that are over 28800 and assigned to the next date that is not Saturday or Sunday and to the same rec. I have been looking into triggers, but I can not even come up with anything close. Any help would be greatly appreciated. thanks, josé _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users