Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: to all SQL experts...
"D.Y." <dyou98_at_aol.com> ???????/???????? ? ???????? ?????????:
news:f369a0eb.0208260916.2fc98edf_at_posting.google.com...
> Got to admit that I haven't seen a smart query like this in a while.
> That sum(sqrt) with group by is tricky. Congratulations. This query
> should work unless there are duplicates in some matching groups but
> not the others.
>
Hi!
I think of it before sending the query and had same doubts as you. And I should
say that it have to work with duplicates.
Consider, for example, the function:
S = sqlrt(a1*b1)+sqlrt(a2*b2), where a1+a2=b1+b2=CONST, and a1>=1, a2>=1, b1>=1, b2>=1.
If gives its maximum, according to differential calculus, on a1=b1, a2=b2 That is:
sqlrt(a1*b1)+sqlrt(a2*b2) <= a1+a2, or sqlrt(a1*b1)+sqlrt(a2*b2) <= b1+b2
and
sqlrt(a1*b1)+sqlrt(a2*b2) = a1+a2, where a1=b1, a2=b2.
I didn't wrote formulas for
S = sqlrt(a1*b1)+sqlrt(a2*b2)+ sqlrt(a3*b3)
But I think it'll be similar for the inequality:
sqlrt(a1*b1)+sqlrt(a2*b2)+ sqlrt(a3*b3) <= a1+a2+a3, where a1+a2+a3=b1+b2+b3=CONST, and a1>=1, a2>=1, a3>=1, b1>=1, b2>=1, b3>=1
OK for now, I can be wrong with the assumption (we all can make errors :-) ) . But can you show its wrong?
Best regards,
Sergey Adamenko.
Received on Mon Aug 26 2002 - 14:57:38 CDT