Re: [SQL] echo/printf function in plpgsql

2005-07-20 Thread Andreas Joseph Krogh
On Wednesday 20 July 2005 01:39, John DeSoi wrote:
> On Jul 19, 2005, at 11:58 AM, Andreas Joseph Krogh wrote:
> > I see. Can I make the ouput somehow less verbose? It spits out a
> > lot of noise
> > for each "NOTICE":
>
> If you just want to output some information to the log, you can use
> something like this:
>
> raise log 't is %', t;
>
> If I recall correctly, the values to be inserted into the format
> string can only be variables, not expressions.

Thanks!

--
AJK

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[SQL] ids from grouped rows

2005-07-20 Thread Lindsay
Lets say i do this:

SELECT name, MAX(age)
FROM Person
GROUP BY name

This will group people who have the same name together, and return the
highest age for each group. I want to be able to find the id for the
person with the highest age in each group  -

Ideally, it would be something like this 

SELECT name, MAX(age), id_for_row_with_max_age
FROM Person
GROUP BY name

Anyone know how to do this?

Lindsay

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] ids from grouped rows

2005-07-20 Thread Ragnar Hafstaư
On Wed, 2005-07-20 at 08:46 -0400, Lindsay wrote:

> SELECT name, MAX(age), id_for_row_with_max_age
> FROM Person
> GROUP BY name

how about:
  select distinct on (name) name, age, id 
 from person
 order by name, age desc;



gnari

 



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [despammed] Re: [SQL] 'show full processlist' in postgres?

2005-07-20 Thread Erik Wasser
On Friday 01 July 2005 22:19, Andreas Kretschmer wrote:

> enable stats_command_string in your postgresql.conf

That was missing. Thanks.

-- 
So long... Fuzz

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org