From: | "Thurstan R(dot) McDougle" <trmcdougle(at)my-deja(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Query |
Date: | 2001-09-14 09:34:36 |
Message-ID: | 3BA1CF2C.5CA6BD65@my-deja.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
TOP is the MS Access equivelant to LIMIT
Text (cut down) from Access 97 help:-
Syntax
SELECT [ALL | DISTINCT | DISTINCTROW | [TOP n [PERCENT]]]
FROM table
TOP n [PERCENT] Returns a certain number of records that fall at the top
of a range specified by an ORDER BY clause. If you don't include the
ORDER BY clause, the query will return an arbitrary set of records. The
TOP predicate doesn't choose between equal values. You can also use the
PERCENT reserved word to return a certain percentage of records that
fall at the top of a range specified by an ORDER BY clause.
What this does not mention, although the syntax shows it, is that the
'predicates' (ALL | DISTINCT | DISTINCTROW | [TOP n [PERCENT]) must be
between the SELECT and the return list, and if more than one is used
must be in the specified order. (DISTINCT/DISTINCTROW before TOP)
However postgresql seems to requires LIMIT to be at the end of the
SELECT (only OFFSET after it). Also there is no PERCENT clause
available.
Joe Conway wrote:
>
> > Hi !
> >
> > I'm trying to execute the following query:
> > "SELECT TOP 10 * FROM table1"
> >
> > It gives me the error message
> > parser: parse error at or near "2"
> >
> > Can i use SELECT TOP ?
> > Is there any other way to execute the same query not using SELECT TOP
> ?
> >
>
> See the LIMIT clause:
> http://www.postgresql.org/idocs/index.php?sql-select.html
>
> Hope this helps,
>
> -- Joe
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
This is the identity that I use for NewsGroups. Email to
this will just sit there. If you wish to email me replace
the domain with knightpiesold . co . uk (no spaces).
From | Date | Subject | |
---|---|---|---|
Next Message | Giorgio Volpe | 2001-09-14 10:13:52 | Re: where cannot use alias name of column? |
Previous Message | Ryan Mahoney | 2001-09-14 08:25:21 | Re: business perspective |