Carlos,

If you don't mind, I'll answer through the list, because there are
people there who know much more than I do.

Here's your question:


> Here I'm looking for subtract two datefields from diferentes tables if

> the field1 is not null, if that field is null the value is 'without 
> close' and this case conditional
>
> CASE
>    WHEN field1 IS NULL
> THEN 'SIN CERRAR'
> ELSE (STRFTIME('%J',field1) - STRFTIME('%J',field2))
> END AS DIAS_CERRAR,


How are you storing your dates? SQLite doesn't have a true date format,
so you need to store it either as a string or a number (which could be a
Julian date, a Unix-style number of seconds since a reference date, or
something else even).

Assuming you are storing your dates as strings like this: 2009-01-09,
the code above should give the difference, in days, between the 2 dates.
Is it not working for you?




> and this
>
> convert(STRFTIME('%J',field1) - STRFTIME('%J',field2))


I'm not sure what this is; convert() is not a standard function in
SQLite. Is this from hsql? Or is it a user-defined function?


glauber



 

-----Original Message-----
From: Carlos Suarez [mailto:carlos.sua...@rolsoft.com] 
Sent: Friday, January 09, 2009 1:14 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Hi, a question from Colombia

Hi, my name is Carlos Suarez from Colombia, I have a few problems while 
I migrated from hsql to sqlite and I want to know if you can help me 
with some of this stuff by this way of mail or have I  to quote in 
somewhere?.

thanksfully

Carlos Suarez



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

Reply via email to