Frank,

Thanks for the tip, worked great.

--
=====================================
Sepehr (Sep) Kiani, Ph.D.
Email: [EMAIL PROTECTED]
http://pergatory.mit.edu/skiani
=====================================

On 11/22/06, Frank Schönheit - Sun Microsystems Germany <
[EMAIL PROTECTED]> wrote:

Hi Sepehr,

> If I just SELECT "q1"."QTY"+"q2"."QTY" AS Total. I get:
> ID    Total
> 1       15
> 2
> 3
> 4
>
> Which is appearantly related to a bug with the HSQL engine and additions
> with NULL fields.

First, that's not a bug. Database engines are free in how they implement
such additions. In fact, every database-independent API has a method to
ask the database how it behaves in this respect, see for instance [1].

> The work arounds I have been able to google appear to only
> work with Quering against tables not against queries. Are there any work
> arounds?

I suppose IFNULL [2] should help you - something like
  SELECT IFNULL("q1".QTY,0) + IFNULL("q2".QTY,0)

Ciao
Frank


[1]http://java.sun.com/j2se/1.5.0/docs/api/java/sql/DatabaseMetaData.html#nullPlusNonNullIsNull()
[2]http://hsqldb.org/doc/guide/ch09.html#N12265

--
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Database                   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to