On 2011-03-27 rsmog...@softperience.eu (Radosław Smogura) wrote:
> Marco Friday 25 March 2011 14:25:47
> > Hi,
> >
> > I have a table like this:
> >
> > id datemin max value
> > 1 2011-03-25 20 30 17
> > 3 2011-03-21 40 55 43
> > 3 2011-0
Marco Friday 25 March 2011 14:25:47
> Hi,
>
> I have a table like this:
>
> iddatemin max value
> 1 2011-03-25 20 30 17
> 3 2011-03-21 40 55 43
> 3 2011-03-23 40 55 52
> 2 2011-02-25 5 2
> 4
gsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Marco
Sent: Friday, March 25, 2011 12:24 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Need help for constructing query
Select all rows that exceeded the alarm values within the last 10 min except
those
Hi David,
thanks for your quick answer. I tried to perform both queries but I failed.
Maybe it's because of the fact that I simplified my example and the one table
is actually a join of two tables. The actual tables look as follows:
monitorsensor=> select * from sensors;
sensorid |
--Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Marco
Sent: Friday, March 25, 2011 10:10 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Need help for constructing query
Just want to add:
> 1) Display the
Hi,
I have a table like this:
id datemin max value
1 2011-03-25 20 30 17
3 2011-03-21 40 55 43
3 2011-03-23 40 55 52
2 2011-02-25 5 2
4 2011-03-15 74
4
Just want to add:
> 1) Display the rows with the highest date per id. That gives as many rows as
>ids exist.
>
> select id, max(date) from mytable group by id;
>
> gives just the id and the date, not the other values. I think of doing this
> in two steps:
select id, max(date),min,value,max f