Hi willy,
select sum(vatval) from jvat : 4 rows, result 27.0
select sum(vatval) from jvat where vatcode='LG' : 1 row, result 0.0
select sum(vatval) from jvat where vatcode='XX' : 0 rows, result null
27.0 - 0.0 = 27.0
27.0 - null = null (the result of any expression including null is null,
from the SQL spec)
This is just as expected.
Regards,
Peter
I have the following table :
-->select * from jvat;
-----------------------------------------------
| VATCODE | VATVAL |
-----------------------------------------------
| 0 | 0.0 |
| 21 | 21.0 |
| 6 | 6.0 |
| LG | 0.0 |
-----------------------------------------------
4 rows selected.
When I do the following select, the result is ok :
-->select (select sum(vatval) from jvat) - (select sum(vatval) from
jvat where vatcode='LG') from jdummy;
--------------------------
|(SELECT SUM(VATVAL)
FROM|
--------------------------
| 27.0 |
--------------------------
1 row selected.
But the following seems a bit odd to me, I would say the result should
be 27.
-->select (select sum(vatval) from jvat) - (select sum(vatval) from
jvat where vatcode='XX') from jdummy;
--------------------------
|(SELECT SUM(VATVAL)
FROM|
--------------------------
| |
--------------------------
Any suggestions ?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.