RE: [SQL] SELECT TOP X -- part 2 -- parse error?

From: Michael J Davis <michael(dot)j(dot)davis(at)tvguide(dot)com>
To: "'justinlong(at)xc(dot)org'" <justinlong(at)xc(dot)org>, pgsql-sql(at)hub(dot)org
Subject: RE: [SQL] SELECT TOP X -- part 2 -- parse error?
Date: 1999-04-22 21:12:43
Message-ID: 93C04F1F5173D211A27900105AA8FCFC145410@lambic.prevuenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

The LIMIT clause is new for version 6.5. You will need to upgrade to take
advantage of "LIMIT".

-----Original Message-----
From: Justin Long [SMTP:justinlong(at)strategicnetwork(dot)org]
Sent: Thursday, April 22, 1999 12:53 PM
To: pgsql-sql(at)hub(dot)org
Subject: [SQL] SELECT TOP X -- part 2 -- parse error?

Thanks for the answers. I downloaded and installed PG5... now I have
a new
problem. I can't seem to access any documentation on the syntax of
the new
additions to PG5, and I'm getting a parse error with the following
command

SELECT * FROM database LIMIT 5

It says

parse error at or near "5"

Also PSQL seems to still say 6.4.2 and have all the 6.4.2 functions
described in its help files. Is this indicative of a bad install?
Everything
I saw appeared to indicate PG5 had installed properly and this parse
error
leads me to think it is trying to interpret the LIMIT command but is
having
problems with syntax.

Justin

-----Original Message-----
From: owner-pgsql-sql(at)postgreSQL(dot)org
[mailto:owner-pgsql-sql(at)postgreSQL(dot)org] On Behalf Of Justin Long
Sent: Thursday, April 22, 1999 10:33 AM
To: pgsql-sql(at)hub(dot)org
Subject: [SQL] SELECT TOP _x_ ??

In Microsoft SQL Server you could issue a command

SELECT TOP 5 * FROM database...

The top 5 indicator would mean to take the top 5 records that
matched the
criteria. I can't seem to find any way to do this in PostgreSQL. I
have a
database of 385 records (which will grow rapidly over the next few
months)
and it takes better than 5 seconds to SELECT from the 385 and then
use a
while loop to display the top 4. I can't imagine what it will be
like when
we reach, say, 10,000 records! So any suggestions for selecting just
the top
5 and speeding the process up a bit?

Any responses will be greatly appreciated. Respond here or to
JustinLong(at)strategicnetwork(dot)org ...

Never retreat. Never surrender. Never cut a deal with a dragon.
_______________________________________________________________
Justin Long CIO / Site Editor
616 Station Square Ct Network for Strategic Missions
Chesapeake, VA 23320 977 Centerville Trnpk CSB 317
JustinLong(at)xc(dot)org Va Beach, VA 23463
Check out our site at: http://www.strategicnetwork.org

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Justin Long 1999-04-22 21:23:33 RE: [SQL] SELECT TOP X -- part 2 -- parse error?
Previous Message JT Kirkpatrick 1999-04-22 20:32:23 backend closing channel unexpectedly