[SQL] ERROR: UNIQUE constraint matching given keys for referenced table "sequences" not found

2001-07-16 Thread Dado Feigenblatt
I'm trying to create some tables with foreign keys. When I try to create a foreign key ... foreign key(seq_code) references sequences(seq_code) on update CASCADE on delete CASCADE, I get this message: ERROR: UNIQUE constraint matching given keys for referenced table "sequences" not f

Re: [SQL] interpreting attributes in pg_class

2001-07-16 Thread Peter Eisentraut
Markus Wagner writes: > I need to find the entries for "my" tables within pg_class, without the > indexes ("..._pkey"). > How does one have to interpret "reltype" and that, and where are the > docs/header files? http://www.de.postgresql.org/users-lounge/docs/7.1/postgres/catalog-pg-class.html -

Re: [SQL] Help with SQL statement - Thanks

2001-07-16 Thread James Orr
SELECT * FROM Payments P1 WHERE Date = (SELECT MAX(Date) FROM Payments P2 WHERE P2.CustomerNo = P1.CustomerNo) I think that will do it. - James - Original Message - From: "Henry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]@postgresql.org> Sent: Saturday, July 14, 2001 3:16 PM Subject: [SQ

[SQL] Re: "Display of specified number of records."

2001-07-16 Thread Gene the Dancing Machine
Use "<", ">" and "AND" after the "WHERE" to filter your return. This works only if your testID is Serialized (ie 1,2,3). If they are uniqueID's, another field must be used in it's place ---(end of broadcast)--- TIP 6: Have you searched our list

Re: [SQL] SQL - histogram

2001-07-16 Thread Mathew White
One way to do this is to use the 'CASE' expression, documented here: http://pgsql.dbexperts.com.br/devel-corner/docs/postgres/functions-conditional.html Because you have only one record per person, you can use the 'COUNT' aggregate function to see how many of each height category match. An examp

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-16 Thread Bruce Momjian
> But - this gives them in reverse timestamp order. So - wrap the query in > a view and then apply your own ORDER BY. > > Can't remember who came up with this (some evil genius :-) - but it > seemed to make sense so I stuck the example in my PostgreSQL notes. We kept rejecting the idea of ORDER

[SQL] interpreting attributes in pg_class

2001-07-16 Thread Markus Wagner
Hi, I need to find the entries for "my" tables within pg_class, without the indexes ("..._pkey"). How does one have to interpret "reltype" and that, and where are the docs/header files? Thanks, Markus ---(end of broadcast)--- TIP 1: subscribe and

[SQL] is it possible to comment each column of a table?

2001-07-16 Thread Bhuvan A
hi all, is it possible to comment a column of a table similar to EXTRA of mySQL. If yes then how?? ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [

[SQL] SELECT * FROM select -- got it!

2001-07-16 Thread Bhuvan A
sorry! infact, i didn't try that with quote. now it is fine.. sorry for ur inconvinence and thankx however. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[SQL] SELECT * from select - HOW?

2001-07-16 Thread Bhuvan A
hi, how can we select * from a view named 'select'?? ---(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] Hey! ORDER BY in VIEWS?

2001-07-16 Thread Richard Huxton
Josh Berkus wrote: > > Pater, Robbie, Bruce, > > Makes sense. I take it that this is a deviation from the ANSI 92 > standard, then? > > What happens if I put an ORDER BY in a view, then call an ORDER BY in a > query, e.g.: > Does the second ORDER BY override or suppliment the view ORDER BY, o