[SQL] Re: How to store a linked list in a RDBMS

2001-06-13 Thread Vivek Khera

> "SR" == Srikanth Rao <[EMAIL PROTECTED]> writes:

SR> I have a linked list representing a tree. How do I
SR> store it in the database? Does PGSQL give us any
SR> special procedures to deal with such structures?

Pick up a data structures book and read up on how to implement a
linked list inside an array.  This maps directly to an SQL table with
a sequential primary key.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/

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



[SQL] Determine the time difference from records in a select

2001-06-13 Thread Creager, Robert S


I apologize in advance, 'cause I think this was addressed a couple of months
ago, but I cannot find it in the archives.

I have a firewall hit database which keeps the date of the hit and the
offenders IP (among other items).  I would like to be able to execute a
select which would show each unique IP and the time difference from the
latest hit to the first hit.  I can do this in scripts, but was wondering if
there is a pure SQL query/queries way to accomplish this.

Help?
Rob

Robert Creager
Senior Software Engineer
Client Server Library
303.673.2365 V
303.661.5379 F
888.912.4458 P
StorageTek
INFORMATION made POWERFUL



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

http://www.postgresql.org/search.mpl



[SQL] large going giving errors.

2001-06-13 Thread jeff

Hi

I have a largeish join that is giving me an error..

here's the query

SELECT 
o.name,o,contactname,o.contactphone,o.fax,o.emailaddy,o.freetelephone,o.address1,o.address2,uw.id,m.manufacturer,i.type,uw.model,uw.color,uw.size,uw.price
  FROM user_wantads AS uw,organisations AS o,users AS u ,itemtypes AS 
i,itemmanufacturers AS m,provinces AS p,cities AS ct,countries AS cy
 WHERE uw.owner = u.loginid
   AND u.belongsto = o.organisationid
   AND m.id=uw.manufacturer
   AND i.id=uw.itemtype
   AND o.provinceid=p.provinceid
   AND o.cityid=ct.cityid AND o.countryid=cy.countryid
   AND uw.id=9

and the error

ERROR:  copyObject: don't know how to copy 704

can anyone shed a little light please ?

jeff.


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



RE: [SQL] large going giving errors.

2001-06-13 Thread Robby Slaughter

What happens when you don't join quite so much? That is, take off the AND
blah blocks,
one by one?
-Robby

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, June 13, 2001 3:38 PM
To: [EMAIL PROTECTED]
Subject: [SQL] large going giving errors.


Hi

I have a largeish join that is giving me an error..

here's the query

SELECT
o.name,o,contactname,o.contactphone,o.fax,o.emailaddy,o.freetelephone,o.addr
ess1,o.address2,uw.id,m.manufacturer,i.type,uw.model,uw.color,uw.size,uw.pri
ce
  FROM user_wantads AS uw,organisations AS o,users AS u ,itemtypes AS
i,itemmanufacturers AS m,provinces AS p,cities AS ct,countries AS cy
 WHERE uw.owner = u.loginid
   AND u.belongsto = o.organisationid
   AND m.id=uw.manufacturer
   AND i.id=uw.itemtype
   AND o.provinceid=p.provinceid
   AND o.cityid=ct.cityid AND o.countryid=cy.countryid
   AND uw.id=9

and the error

ERROR:  copyObject: don't know how to copy 704

can anyone shed a little light please ?

jeff.


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


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[SQL] Getting a specific row from a table

2001-06-13 Thread Hunter, Ray
Title: Getting a specific row from a table





My problem is that I want to pull to specific rows from a query result.


First here is the query:
SQL-query:
select card, status, time_stamp, comp_date
from test_record
where id = 45
order by card, comp_date 


Next here is the result:


card                    status      time stamp          Comp_Date
ER16-04 ER16-08             No      2001-06-13 13:56:52-06  6/10/01 
ER16-04 ER16-08             Yes         2001-06-11 11:37:04-06  6/11/01 
ER16-04 ER16-08             No      2001-06-11 13:13:07-06  6/11/01 
ER16-04 ER16-08             No      2001-06-11 13:13:37-06  6/11/01 
ER16-04 ER16-08             No      2001-06-13 13:57:41-06  6/12/01 
ER16-04 ER16-08             Yes         2001-06-13 13:10:46-06  6/13/01 
ER16-04 ER16-08             No      2001-06-13 13:35:29-06  6/13/01 
SSR-ATM29-02 SSR-FDDI-02    No      2001-06-11 13:21:01-06  6/11/01 
SSR-ATM29-02 SSR-FDDI-02    Yes         2001-06-11 13:21:17-06  6/11/01 
SSR-ATM29-02 SSR-FDDI-02    No      2001-06-11 13:21:41-06  6/11/01 
SSR-ATM29-02 SSR-FDDI-02    Yes         2001-06-11 13:22:21-06  6/11/01 


What I want is the two rows that are bold.  However this list will continue to grow and have more card types.  I always want the last card type in the card group, because this has the comp_date that I am looking for.

Thanks,


 
RAY HUNTER
Automated Test Group


 
ENTERASYS NETWORKS
 
Internal: 53888
Phone:   801 887-9888
Fax:  801 972-5789
Cellular:  801 698-0622
E-mail:   [EMAIL PROTECTED]
 
www.enterasys.com





RE: [SQL] large going giving errors.

2001-06-13 Thread jeff

i actually found the problem,

SELECT o.name,o,contactname

should be

SELECT o.name,o.contactname

jeff



On Wed, 13 Jun 2001, Robby Slaughter wrote:

> What happens when you don't join quite so much? That is, take off the AND
> blah blocks,
> one by one?
> -Robby
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, June 13, 2001 3:38 PM
> To: [EMAIL PROTECTED]
> Subject: [SQL] large going giving errors.
>
>
> Hi
>
> I have a largeish join that is giving me an error..
>
> here's the query
>
> SELECT
> o.name,o,contactname,o.contactphone,o.fax,o.emailaddy,o.freetelephone,o.addr
> ess1,o.address2,uw.id,m.manufacturer,i.type,uw.model,uw.color,uw.size,uw.pri
> ce
>   FROM user_wantads AS uw,organisations AS o,users AS u ,itemtypes AS
> i,itemmanufacturers AS m,provinces AS p,cities AS ct,countries AS cy
>  WHERE uw.owner = u.loginid
>AND u.belongsto = o.organisationid
>AND m.id=uw.manufacturer
>AND i.id=uw.itemtype
>AND o.provinceid=p.provinceid
>AND o.cityid=ct.cityid AND o.countryid=cy.countryid
>AND uw.id=9
>
> and the error
>
> ERROR:  copyObject: don't know how to copy 704
>
> can anyone shed a little light please ?
>
> jeff.
>
>
> ---(end of broadcast)---
> TIP 4: Don't 'kill -9' the postmaster
>
>


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [SQL] large going giving errors.

2001-06-13 Thread Tom Lane

<[EMAIL PROTECTED]> writes:
> SELECT 
>o.name,o,contactname,o.contactphone,o.fax,o.emailaddy,o.freetelephone,o.address1,o.address2,uw.id,m.manufacturer,i.type,uw.model,uw.color,uw.size,uw.price
>   FROM user_wantads AS uw,organisations AS o,users AS u ,itemtypes AS 
>i,itemmanufacturers AS m,provinces AS p,cities AS ct,countries AS cy
>  WHERE uw.owner = u.loginid
>AND u.belongsto = o.organisationid
>AND m.id=uw.manufacturer
>AND i.id=uw.itemtype
>AND o.provinceid=p.provinceid
>AND o.cityid=ct.cityid AND o.countryid=cy.countryid
>AND uw.id=9

> ERROR:  copyObject: don't know how to copy 704

You probably wanted "o.contactname" not "o,contactname".

7.2 will give a more useful error message for this sort of mistake ...

regards, tom lane

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