Re: [SQL] Grouping Too Closely

2005-06-24 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > This doesn't give me quite what I'm looking for because I need there > to be only one of each possible value of seq2 to be returned for each > value of fkey. Then perhaps just: SELECT fkey, seq2, min(seq1) FROM my_table WHERE seq2 > 2 GROUP BY fk

Re: [SQL] Grouping Too Closely

2005-06-24 Thread Thomas F. O'Connell
This doesn't give me quite what I'm looking for because I need there to be only one of each possible value of seq2 to be returned for each value of fkey. -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC Strategic Open Source: Open Your i™ http://www.sitening.com/ 110 3

Re: [SQL] Grouping Too Closely

2005-06-24 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > What I'd like to be able to do is select all records corresponding to > the minimum value of seq1 for each value of seq2 corresponding to a > given fkey (with a lower bound on the value of seq2). I'm not sure how uid figures in, but would this do

Re: [SQL] people who buy A, also buy C, D, E

2005-06-24 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > The goal of my query is: given a book, what did other people who > bought this book also buy? I plan the list the 5 most popular such > books. I've been playing with this a little bit, and I don't think you are going to get better than you alread

[SQL] Default index space?

2005-06-24 Thread Dmitri Bichko
Hi all, The docs mention specifying a default tablespace for a database, but it doesn't seem like you can specify a separate default tablespace for indices. Did I overlook something, or is it really not possible to do this? Thanks, Dmitri The information transmitted is intended only for the pers

Re: [SQL] Converting TBL->View complaining about indexes

2005-06-24 Thread Michael Fuhr
On Fri, Jun 24, 2005 at 05:49:02PM +0200, KÖPFERL Robert wrote: > > ERROR: could not convert table "smsMessagesrewtet" to a view because it has > indexes See the comments for pg_class.relhasindex: http://www.postgresql.org/docs/8.0/static/catalog-pg-class.html "True if this is a table and it ha

[SQL] Converting TBL->View complaining about indexes

2005-06-24 Thread KÖPFERL Robert
Hi, I'm currently trying to make a table (where many fcns depend on) become a view. Thus I did a _truncate_ and lots of _alter table drop constraint_ and _drop index_ and then CREATE OR REPLACE RULE "_RETURN" AS ON SELECT TO "smsMessagesrewtet" DO INSTEAD SELECT "MessageID",. Post

Re: [SQL] empty view, replace view, column type change?

2005-06-24 Thread Tom Lane
Bruce Momjian writes: > Tom Lane wrote: >> but it doesn't seem to me to follow from what the spec says that we need >> to explicitly cast the result of now() to six places. As long as it's >> coming from gettimeofday it can't have more than 6 places anyway, and so >> we might as well save the ext