Received: from fileserver002.intecsystems.co.uk ([194.200.14.125]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3A9ND877931 for ; Tue, 10 Apr 2001 05:23:13 -0400 (EDT) (envelope-from Michael.Ansley@intec-telecom-systems.com) Received: from fileserver002.intecsystems.co.uk (unverified) by fileserver002.intecsystems.co.uk (Content Technologies SMTPRS 4.1.5) with ESMTP id ; Tue, 10 Apr 2001 10:30:23 +0100 Received: by fileserver002.intecsystems.co.uk with Internet Mail Service (5.5.2650.21) id <2T32MCC6>; Tue, 10 Apr 2001 10:30:23 +0100 Message-ID: <7F124BC48D56D411812500D0B747251480F51A@fileserver002.intecsystems.co.uk> From: Michael Ansley To: "'Roberto Mello'" , wweng@pobox.com Cc: pgsql-sql@postgresql.org Subject: RE: Sorting and then... Date: Tue, 10 Apr 2001 10:30:22 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/alternative ; boundary="----_=_NextPart_001_01C0C1A0.DDA565CA" X-Archive-Number: 200104/132 X-Sequence-Number: 2479 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0C1A0.DDA565CA Content-Type: text/plain; charset="iso-8859-1" But if you want the largest 10, then you can: SELECT name FROM ORDER BY id DESC LIMIT 10; assuming that you mean largest numerically. Cheers... MikeA >> -----Original Message----- >> From: Roberto Mello [mailto:rmello@cc.usu.edu] >> Sent: 10 April 2001 03:41 >> To: wweng@pobox.com >> Cc: pgsql-sql@postgresql.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
; >> >> -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@postgresql.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. __________________________________________________________________________ ------_=_NextPart_001_01C0C1A0.DDA565CA Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [SQL] Sorting and then...

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@cc.usu.edu]
>> Sent: 10 April 2001 03:41
>> To: wweng@pobox.com
>> Cc: pgsql-sql@postgresql.org
>> Subject: Re: [SQL] Sorting and then...
>>
>>
>> On Mon, Apr 09, 2001 at 07:22:52PM -0400, Wei W= eng 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 &q= uot;largest"? Largest id? "largest"
>> text string? If
>> it's the id you can do:
>>
>>      select max(id) from &l= t;table>;
>>
>>      -Roberto
>> --
>> +----| http://fslc.usu.edu USU Free Software & GNU/Linux
>> Club |------+
>>   Roberto Mello - Computer Science, U= SU - http://www.bra= sileiro.net
>>        http://www.sdl.usu.edu = - Space Dynamics Lab, Developer   
>> Backup is for whimps!
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, pleas= e send an appropriate
>> subscribe-nomail command to majordomo@postgresq= l.org so that your
>> message can get through to the mailing list cle= anly
>>



_________________________________________________________________________ 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 yo= u are not an
intended or authorised recipient of this e-mail or have received it in erro= r, please delete
it immediately and notify the sender by e-mail. In such a case, reading, r= eproducing,
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-ma= il and any
attachments may be those of the author and are not necessarily those of Int= ec Telecom
Systems PLC.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
__________________________________________________________________________<= BR>
------_=_NextPart_001_01C0C1A0.DDA565CA--