Rafi Cohen wrote:
Thanks Denis for your detailed explanation. My needs differ from the
example you gave.
I need to compare the date on each row with the current date, if the
rowdate has passed then I either insert or update this row on a specific
table, otherwise I leave this row for a future check.
So, the comparison has to be made in C and not sqlite, I think.
Now, suppose I brought the rowdate to the format "YYYY-mm--dd HH:MM:SS".
In order to call strcmp() to compare with the current date, I need to
bring the current date to the same format. How can I do this, or you
have other ideas to make this comparison?
Rafi,
There is no need for C in case you have given. A simple insert of
selected data should do.
insert or ignore into over_due
select id from schedule
where (due_date || ' ' || due_time) < datetime('now');
This uses one of sqlite's builtin date and time functions (see
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions ) to format
the current time into an ISO format that can be compared directly with
the concatenated fields from your existing table. The id of any records
that meet the condition are inserted into the over_due table (or ignored
if they already exist in that table).
HTH
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------