using Avg()

From: "Mark Connelly(at)South Central" <Mark(dot)Connelly(at)ntl(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: using Avg()
Date: 2003-02-27 16:59:26
Message-ID: 685AD5FCEB6BD5119A3A0008C7DB50510515D04A@MAST-WI0-SE01
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table with a column named SwErr (Switch Error) with int values
date with datetime values and SwID with char(3)
I am trying to get a subset back where the folowing is true

select the avg(SwErr) for the last 30 days where SwId = 'XX1'
Select the value of todays value of SwErr where SwId = 'XX1'
if todays value of SwErr is greater than 4 times the SwErr Average return in
the value

TIA

Mark Connelly




The contents of this email and any attachments are sent for the personal attention
of the addressee(s) only and may be confidential. If you are not the intended
addressee, any use, disclosure or copying of this email and any attachments is
unauthorised - please notify the sender by return and delete the message. Any
representations or commitments expressed in this email are subject to contract.

ntl Group Limited

Browse pgsql-sql by date

  From Date Subject
Next Message Valerie Goodman 2003-02-27 18:28:25 Re: Copy from a SELECT
Previous Message Hubert depesz Lubaczewski 2003-02-27 15:53:03 Re: how to return ONE single record from a function in plpgsql?