Re: [SQL] UPDATE WITH ORDER BY

2005-04-26 Thread Christoph Haller
Rodrigo Carvalhaes wrote: Hi Guys! I need to make an UPDATE on a column reordering it with a sequence using order by a description. Confusing??? Well.. Let me give an example... Today, my table it's organized like this: Code / Description 9 Orange 15 Apple 1

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

2005-04-26 Thread Christoph Haller
Dan Langille wrote: 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. In reality, this isn't about books, but that makes it easier to understand I think. We have a table of customer_id

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

2005-04-26 Thread Dan Langille
On 26 Apr 2005 at 14:24, Christoph Haller wrote: Dan Langille wrote: 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. In reality, this isn't about books, but that makes it easier to understand

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

2005-04-26 Thread Achilleus Mantzios
O Christoph Haller Apr 26, 2005 : Dan Langille wrote: 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. In reality, this isn't about books, but that makes it easier to understand I think.

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

2005-04-26 Thread Christoph Haller
Dan Langille wrote: On 26 Apr 2005 at 14:24, Christoph Haller wrote: Dan Langille wrote: 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. In reality, this isn't about books, but that

Re: [SQL] UPDATE WITH ORDER BY

2005-04-26 Thread Rodrigo Carvalhaes
Thanksyou and Franz for your help. Simple and efficient... I was blind The plpgsql "for" is the perfect solution It was great. Have a nice week!!! Cheers, Rodrigo Carvalhaes Christoph Haller wrote: Rodrigo Carvalhaes wrote: Hi Guys! I need to make an UPDATE on a column

[SQL] several questions about R-tree index

2005-04-26 Thread TJ O'Donnell
According to the manual at: http://www.postgresql.org/docs/7.4/static/functions-geometry.html The PostgreSQL query planner will consider using an R-tree index whenever an indexed column is involved in a comparison using one of these operators: , , , , @, ~=, (Refer to Section 9.9 about the

Re: [SQL] several questions about R-tree index

2005-04-26 Thread Andrew - Supernews
On 2005-04-26, TJ O'Donnell [EMAIL PROTECTED] wrote: But I think I might be able to do better (faster) using R-trees. Bitstrings can be thought of as containing when one bitstring has all the same bits set as another, even if it has other bits set too - this is the gist of the first

Re: [SQL] several questions about R-tree index

2005-04-26 Thread Tom Lane
TJ O'Donnell [EMAIL PROTECTED] writes: Shouldn't the ~ (contains) operator be included also? Isn't ~ the commutator of @ ? Yeah, it looks like the documentation is in error: regression=# select amopopr::regoperator,amopstrategy from pg_amop where amopclaid in regression-# (select oid from