Subject Re: comparing return value of select subquery
Author Adam
--- In, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
> Hi Adam!
> The one alternative I can think of is
> select
> ta.a,
> ta.b,
> sum(tb.c) as c
> from ta
> join tb on ta.a = tb.a
> group by ta.a, ta.b
> having ta.b <> sum(tb.c)
> Though I don't know if this is better or even gets the result you want
> (more complex may mean that simple solutions do not exist).


Your query returns the right result for my test case here, but I am
not yet confident it will return the right result in all situations. I
just need to study it a bit more.

Given that there may be multiple records in tb for every ta record, I
may need to use distinct as well.