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@strategicnetwork.org]Sent: Thursday, April 22, 1999
12:53PMTo: pgsql-sql@hub.orgSubject: [SQL] SELECT TOP X -- part 2 -- parse error?
Thanks for the answers. I downloaded and installed PG5... now I have
a newproblem. I can't seem to access any documentation on the syntax of
the newadditions 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 functionsdescribed in its help files. Is this indicative of a
badinstall?
EverythingI saw appeared to indicate PG5 had installed properly and this parse
errorleads me to think it is trying to interpret the LIMIT command but is
havingproblems with syntax.
Justin
-----Original Message-----From: owner-pgsql-sql@postgreSQL.org[mailto:owner-pgsql-sql@postgreSQL.org] On Behalf Of
JustinLongSent: Thursday, April 22, 1999 10:33 AMTo: pgsql-sql@hub.orgSubject: [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 thecriteria. I can't seem to find any way to do this in PostgreSQL. I
have adatabase 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 awhile loop to display the top 4. I can't imagine what it will be
like whenwe reach, say, 10,000 records! So any suggestions for selecting just
the top5 and speeding the process up a bit?
Any responses will be greatly appreciated. Respond here or toJustinLong@strategicnetwork.org ...
Never retreat. Never surrender. Never cut a deal with a
dragon._______________________________________________________________JustinLong CIO / Site Editor616
StationSquare Ct Network for Strategic MissionsChesapeake, VA 23320 977 Centerville Trnpk CSB
317JustinLong@xc.org Va Beach, VA 23463Check out our site at: http://www.strategicnetwork.org