: Re: [SQL] Function Parameters in GROUP BY clause cause errors
I wrote:
> Hmm, this seems like a plpgsql deficiency. It feels it can generate a
> separate parameter symbol ($n) for each occurrence of each variable it
> passes into a SQL query. But for this query to be legal, the two
&g
I wrote:
> Hmm, this seems like a plpgsql deficiency. It feels it can generate a
> separate parameter symbol ($n) for each occurrence of each variable it
> passes into a SQL query. But for this query to be legal, the two
> instances of IntervalMinutes have to be represented by the *same*
> parame
Title: Function Parameters in GROUP BY clause cause errors
Just Put aggregate function to the fields
you selected.
Like this:
select
to_char(to_timestamp(EXTRACT(HOUR FROM max(em.email_creation_datetime))
|| ':' || (EXTRACT(MINUTE FROM max(em.email_creation_datetime))::integer/30)
* 30
"Davidson, Robert" <[EMAIL PROTECTED]> writes:
> ERROR: column "em.email_creation_datetime" must appear in the GROUP BY =
> clause or be used in an aggregate function
> CONTEXT: SQL statement " select to_char(to_timestamp(EXTRACT(HOUR FROM =
> em.email_creation_datetime) || ':' || (EXTRACT(MINUTE