RE: Sorting and then...

From: Michael Ansley <Michael(dot)Ansley(at)intec-telecom-systems(dot)com>
To: "'Roberto Mello'" <rmello(at)cc(dot)usu(dot)edu>, wweng(at)pobox(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: RE: Sorting and then...
Date: 2001-04-10 09:30:22
Message-ID: 7F124BC48D56D411812500D0B747251480F51A@fileserver002.intecsystems.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

But if you want the largest 10, then you can:

SELECT name FROM <table> ORDER BY id DESC LIMIT 10;

assuming that you mean largest numerically.

Cheers...

MikeA

>> -----Original Message-----
>> From: Roberto Mello [mailto:rmello(at)cc(dot)usu(dot)edu]
>> Sent: 10 April 2001 03:41
>> To: wweng(at)pobox(dot)com
>> Cc: pgsql-sql(at)postgresql(dot)org
>> Subject: Re: [SQL] Sorting and then...
>>
>>
>> On Mon, Apr 09, 2001 at 07:22:52PM -0400, Wei Weng wrote:
>>
>> > And I want to get the names of the largest 10 "id"s. How
>> can I do that in
>> > sql?
>>
>> What do you mean by "largest"? Largest id? "largest"
>> text string? If
>> it's the id you can do:
>>
>> select max(id) from <table>;
>>
>> -Roberto
>> --
>> +----| http://fslc.usu.edu USU Free Software & GNU/Linux
>> Club |------+
>> Roberto Mello - Computer Science, USU - http://www.brasileiro.net
>> http://www.sdl.usu.edu - Space Dynamics Lab, Developer
>> Backup is for whimps!
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>> message can get through to the mailing list cleanly
>>

_________________________________________________________________________
This e-mail and any attachments are confidential and may also be privileged and/or copyright
material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an
intended or authorised recipient of this e-mail or have received it in error, please delete
it immediately and notify the sender by e-mail. In such a case, reading, reproducing,
printing or further dissemination of this e-mail is strictly prohibited and may be unlawful.
Intec Telecom Systems PLC. does not represent or warrant that an attachment hereto is free
from computer viruses or other defects. The opinions expressed in this e-mail and any
attachments may be those of the author and are not necessarily those of Intec Telecom
Systems PLC.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
__________________________________________________________________________

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Peltonen 2001-04-10 11:07:50 Re: 7.1 out soon?
Previous Message Stan van de Mortel 2001-04-10 08:53:13 Foreign Key between different databases