Subject | RE: [firebird-support] Strange Query Results |
---|---|
Author | Alan McDonald |
Post date | 2004-12-08T21:33:06Z |
> Hi All,smels like there are null values somewhere...
>
> I'm using FB v1.5 and IBExpert v2004.08.05. I've found a situation
> where the query result set seems really wierd.
>
> select sum(iu.QtySold * iu.ItemPrice), sum(iu.QtyUsed * iu.ItemPrice)
> from xItemUsages iu
> where iu.MinorID = 900033
>
> yields results of $2,538.6535 and $2,718.5150.
>
> However,
>
> select sum(iu.QtySold * iu.ItemPrice), sum(iu.QtyUsed * iu.ItemPrice)
> from xItemUsages iu
> join xLedgItem li on li.InvItemID = iu.InvItemID
> where iu.MinorID = 900033
>
> yields results of $19,769.4608 and $21,230.3890.
>
> My original intent was to add the sum of a field in the xLedgItem
> table but, when I added the join to that table, my result set when
> crazy. As you can see, I have no ambiguous field references and all
> the fields in both result sets are exactly the same. The only
> difference is the join line.
>
> Where is this result coming from?
>
> Thanks for any help in understanding this,
> Steve
Alan