× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 4/3/2012 8:00 AM, Birgitta Hauser wrote:
select client, min(childAge) as youngest, max(childAge) as eldest
from table group by client
having youngest< 20 and eldest> 20
This is nearly right, except correlation names or names for temporary
columns are NOT allowed within the same sub-select, i.e. youngest and eldest
cannot be used in the having clause.
Select Client, Min(ChildAge), Max(ChildAge)
> From Table
Group by Client
Having Min(ChildAge)< 20 and Max(ChildAge)> 20



Yes, of course, Birgitta. Thanks for taking the time to point that out. Something didn't look quite right, but I couldn't put my finger on it.

This is one of the things I wish could be fixed in SQL. I'm not sure why it's such a problem, but the restriction really makes it difficult to do complex grouping calculations. You basically have to type the exact same logic twice, which provides an opportunity for typos (something I'm VERY good at).

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.