Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!cimshop!dsm From: dsm@cimshop.UUCP (David Masterson) Newsgroups: comp.databases Subject: Re: Nesting SQL Commands? Message-ID: <421@cimshop.UUCP> Date: 18 Apr 89 16:28:11 GMT References: <4YGLTiy00VA-MCvmVY@andrew.cmu.edu> Organization: Consilium Mt. View CA Lines: 16 In-reply-to: dp22+@andrew.cmu.edu's message of 17 Apr 89 05:36:46 GMT In message <4YGLTiy00VA-MCvmVY@andrew.cmu.edu>, dp22+@andrew.cmu.edu writes: > Is there an implementation of SQL around that will allow functions >to be nested in the same where clause? >i.e. > > WHERE AVG(Col1 + Col2) = MIN(AVG(Col1+Col2)) > What is the MINimum of an AVeraGe? An average is only one number just like a minimum is. An aggregate function takes as input a set of numbers and produces a number as output. Therefore, nesting two aggregate functions like above doesn't make sense, but does the following? WHERE MIN(col1) > MIN(col2 + AVG(col1)) David Masterson uunet!cimshop!dsm or DMasterson@cup.portal.com