Re: [GENERAL] top predicate

2006-05-11 Thread Karen Hill
Jan de Visser wrote: > On Thursday 11 May 2006 16:34, Karen Hill wrote: > > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here > > is an example: > > > > SELECT TOP 10 products from sales; > > Just for my understanding: This would return the 10 products with the most > matching

Re: [GENERAL] top predicate

2006-05-11 Thread Karen Hill
Tom Lane wrote: > "Karen Hill" <[EMAIL PROTECTED]> writes: > > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? > > It's not in the SQL standard. If we were to implement something like > what I think you're asking for (your example is way underspecified), > it'd probably look like

Re: [GENERAL] top predicate

2006-05-11 Thread Ben
Have you tried using the LIMIT clause? select porducts from sales limit 10; http://www.postgresql.org/docs/8.1/interactive/queries-limit.html On Thu, 11 May 2006, Karen Hill wrote: It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here is an example: SELECT TOP 10 products fro

Re: [GENERAL] top predicate

2006-05-11 Thread Joshua D. Drake
Karen Hill wrote: It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here is an example: SELECT TOP 10 products from sales; Just use: SELECT product from sales limit 10 OR SELECT products from sales order by products desc limit 10; Joshua D. Drake --

Re: [GENERAL] top predicate

2006-05-11 Thread Jan de Visser
On Thursday 11 May 2006 16:34, Karen Hill wrote: > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here > is an example: > > SELECT TOP 10 products from sales; Just for my understanding: This would return the 10 products with the most matching sales rows, right? jan -- --

Re: [GENERAL] top predicate

2006-05-11 Thread Tom Lane
"Karen Hill" <[EMAIL PROTECTED]> writes: > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? It's not in the SQL standard. If we were to implement something like what I think you're asking for (your example is way underspecified), it'd probably look like SQL2003's window functions.