Re: [SQL] Mail for error in tuples

From: Vikrant Rathore <vikrant(at)chemquick(dot)com>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Mail for error in tuples
Date: 1999-06-11 19:41:31
Message-ID: 3761666B.4D11AB35@chemquick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear Jackson,

The tuple in radius tables are there in the attached file.
Now the following things are to be done:
1. Select a tuple and subsequent tuple and find the timespan between the
datetime of first and the subsequent tuple. if the timespan is greater than the
duration given in the subsequent tuple then update the subsequent tuple with
duration set to the timespan between the first selected tuple and subsequent
tuple:
Consider the following tuples
first tuple:
uname=penguin
logdate=06/12/1999
logtime=11:00:00AM
duration=1 Hrs
rest can be left as such
subsequent tuple
uname=penguin
logdate=06/12/1999
logtime=12:00:00 PM
duration=2 Hrs
Then in the subsequent tuple the duration is wrong this data is taken from a
external source now want to validate it by applying the above condition so the
duration in the second tuple should be set to
uname=penquin
logdate=06/12/1999
logtime=12:00:00 PM
duration=1 Hrs.
Now can you tell me how can i achieve this in postgresql. I am new to
postgresql.
Thanks a lot for your prompt reply.

Regards,
Vicky

"Jackson, DeJuan" wrote:

> It might be best if you gave us an actual example or two in stead of trying
> to describe the situation (I couldn't follow it, I have no idea what a
> radius log is either). So, show us what you're after.
> -DEJ
>
> > -----Original Message-----
> > From: Vikrant Rathore [SMTP:vikrant(at)chemquick(dot)com]
> > Sent: Friday, June 11, 1999 1:45 PM
> > To: pgsql-sql(at)postgreSQL(dot)org
> > Subject: [SQL] Mail for error in tuples
> >
> > Dear friend,
> >
> > I have a table named radius with structure
> >
> > Table = radius
> > +----------------------------------+----------------------------------+---
> > ----+
> >
> > | Field | Type |
> > Length|
> > +----------------------------------+----------------------------------+---
> > ----+
> >
> > | uname | char()
> > | 256 |
> > | logdate | date
> > | 4 |
> > | logtime | time
> > | 8 |
> > | duration | timespan
> > | 12 |
> > | status | char()
> > | 20 |
> > | nasadd | char()
> > | 20 |
> > | port | int4
> > | 4 |
> > | bytesin | int4
> > | 4 |
> > | bytesout | int4
> > | 4 |
> > | packin | int4
> > | 4 |
> > | packout | int4
> > | 4 |
> > | misc | int4
> > | 4 |
> > +----------------------------------+----------------------------------+---
> > ----+
> >
> > I keep my radius log in this table.
> >
> > Now in this logdate and logtime are the last logout date and time for
> > the particular user.
> >
> > But sometimes the logdate and logtime and duration are wrong so inorder
> > to correct i have to do following can anyone help me how to do it.
> >
> > I want to select the tuples of particular user and test the first
> > logdate and logtime with the next tuples logdate and logtime and the
> > duration in the second tuple should not be greater than the difference
> > of this two tuples if its greater than the difference then it needs to
> > be set to the difference of the two logdate and logtime. I have to test
> > it till the last tuple.
> > So can anyone suggest me query for this job.
> >
> > Thanks in advance.
> >
> > Regards,
> > Vicky
> >
> >

Attachment Content-Type Size
tuples.out text/plain 29.1 KB

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jackson, DeJuan 1999-06-11 22:07:38 RE: [SQL] Mail for error in tuples
Previous Message Jackson, DeJuan 1999-06-11 19:08:32 RE: [SQL] Mail for error in tuples