Hello,

The simple query is like this:
SELECT dbs as summadeb from bilance1 where account='13100' and pYear=?;

Account number 13100 is not present in the table bilance1 when
pYear=2005 and it should be like this and therefore dbs is also not
present. Other years account number 13100 is present and query works
OK.

When the query is run with a parameter pYear='2005' it returns nothing
- the resultset is empty or nothing? (I am doing it from python25)

Even if I change the query to :
SELECT coalesce(dbs,0) as summadeb from bilance1 where account='13100'
and pYear='2005'; it still returns NOTHING, not 0.

The same happens also on MS SQLServer 2005 so I think it should be
like that according to sql standards. If there is no account number
13100 in the table then the result is NOTHING, not NULL or 0.
Strictly speaking I think also the value of 0 is not correct in this
case but I would like to have it.
It seams that coalesce can handle NULL not NOTHING.

My question is:
Is there an SQL way to handle above query to return 0 or should I
handle this in client program (python)? (presently I get TypeError:
'NoneType' object is unsubscriptable)

Using sqlite 3.6.2, python2.5 and Windows XP

Thanks in advance

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

Reply via email to