Skip site navigation (1) Skip section navigation (2)

group by : syntactic example (sybase)

From: De Clarke <de(at)ucolick(dot)org>
To: David Hartwig <daveh(at)insightdist(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: group by : syntactic example (sybase)
Date: 1998-06-16 21:25:18
Message-ID: de-980616142515.A0E22710@celeste.ucolick.org (view raw or flat)
Thread:
Lists: pgsql-hackers
David Hartwig said:

>> Do you mean in a select statement?   Such as:
>> 
>>     SELECT func(date) as month, count(*) FROM foo GROUP BY month;
>> 
>> Or even:
>> 
>>     SELECT count(*) FROM foo GROUP BY func(date);
>> 
>> The first is supported.   The second would require some changes to the parser.

#2 was what I had in mind...

This is a pointless query, but it demonstrates a couple of
things that the sybase SQL interpreter supports:

	select avg(datepart(minute,date)) from hires_events 
		group by datepart(hour,date)

1.  you can apply stat functions such as avg and sum to
	functions on columns as well as to raw columns

2.  you can group by a function on a column

I think Oracle will do this also...

de

.............................................................................
:De Clarke, Software Engineer                     UCO/Lick Observatory, UCSC:
:Mail: de(at)ucolick(dot)org | "There is no problem in computer science that cannot: 
:Web: www.ucolick.org |  be solved by another level of indirection"  --J.O. :




In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-06-16 21:32:59
Subject: Re: [HACKERS] non-functional update notice unneccesarily
Previous:From: Brett McCormickDate: 1998-06-16 21:03:04
Subject: Re: [HACKERS] seq scan only when function not in subquery (bug?)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group