Re: [sqlite] Substract and decimal
THANK'S A LOT IGOR Igor Tandetnik escribió: > Carlos Suarez> wrote: > >> An date field can be null or not, depending of this the field it >> writes 'without_a_date' or the number of days from a date to another >> *the problem is only the presentation cause I need the subtract >> without decimals number* but round doesn't work here because the >> result is "without_a_date" or ie: 34.0 or any number with period and >> zero, I need only 34 in that case or 'withoutadate' >> > > Try CAST(round(...) as integer) > > Igor Tandetnik > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Substract and decimal
Carlos Suarezwrote: > An date field can be null or not, depending of this the field it > writes 'without_a_date' or the number of days from a date to another > *the problem is only the presentation cause I need the subtract > without decimals number* but round doesn't work here because the > result is "without_a_date" or ie: 34.0 or any number with period and > zero, I need only 34 in that case or 'withoutadate' Try CAST(round(...) as integer) Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Substract and decimal
Hello, I need to use a case with that situation: An date field can be null or not, depending of this the field it writes 'without_a_date' or the number of days from a date to another *the problem is only the presentation cause I need the subtract without decimals number* but round doesn't work here because the result is "without_a_date" or ie: 34.0 or any number with period and zero, I need only 34 in that case or 'withoutadate' select case when (date1field is null) then ('without_a_date') else round (strftime('%J',date1field)-strftime('%J',date2field)) end as datessubstract from datestable I need XX not XX.0 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users