Thread: Top

Top

From
pmiranda@vm.com.br
Date:
Hi,

Please, does anyone know if is there in Postgres's SQL language an
equivalent for Oracle's TOP ?

Thanks again,


Paulo



Re: Top

From
"Colin 't Hart"
Date:
> Please, does anyone know if is there in Postgres's SQL language an
> equivalent for Oracle's TOP ?

Ummm, Oracle's SQL doesn't have a TOP.

Are you thinking of SQL Server?


Cheers,

Colin




RE: Re: Top

From
"Michael Ansley (UK)"
Date:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anyway, it's a combination of ORDER BY and LIMIT:

SELECT * FROM table1 ORDER BY field1 DESC LIMIT 10;

or, if you want the bottom ten:

SELECT * FROM table1 ORDER BY field1 LIMIT 10;

Or, if you want the next ten:

SELECT * FROM table1 ORDER BY field1 LIMIT 10, 10;

or something to that effect.

MikeA

>> -----Original Message-----
>> From: Colin 't Hart [mailto:cthart@yahoo.com]
>> Sent: 08 August 2001 08:17
>> To: pgsql-admin@postgresql.org
>> Subject: [ADMIN] Re: Top
>>
>>
>> > Please, does anyone know if is there in Postgres's SQL language
>> > an equivalent for Oracle's TOP ?
>>
>> Ummm, Oracle's SQL doesn't have a TOP.
>>
>> Are you thinking of SQL Server?
>>
>>
>> Cheers,
>>
>> Colin
>>
>>
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo@postgresql.org
>>

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBO3D+BXympNV/C086EQLevwCgpxcbIiA4OWcjmXQhirB0g4Ts4wEAnjSv
WxaprcluB2uhv5gmtaM6rCbI
=jPE0
-----END PGP SIGNATURE-----

_________________________________________________________________________
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.
__________________________________________________________________________

RE: Re: Top

From
pmiranda@vm.com.br
Date:
----- Forwarded by Paulo Miranda/RJ/VMCS on 08/08/01 15:39 -----

                    Paulo Miranda
                                         To:     "Michael Ansley (UK)" <Michael.Ansley@intec-telecom-systems.com>
                    08/08/01 15:34       cc:
                                         Subject:     RE: [ADMIN] Re: Top(Document link: Paulo Miranda)




Mike,

Thank you very much. After writing the first message, (cause I'm behind
schedule) I tried that and it worked fine. Thanks for the other tips,
they'll be very useful for me.

I wanna thank Colin, too, and ask him to forgive my mistake. TOP is, in
fact, a SQLSERVER's SELECT clause (or whatever they call it). I don't even
know if there's something that compares to this in Oracle.

In portuguese, we say "obrigado" for "thank you". From now on, I ask you to
allow me to use this expression instead of the one in english. (I know I'll
make some many questions to you...)

:)


Paulo





              
                    "Michael Ansley (UK)"
              
                    <Michael.Ansley@intec-telecom-sy        To:     pgsql-admin@postgresql.org, "'pmiranda@vm.com.br'"
              
                    stems.com>                              <pmiranda@vm.com.br>
              
                    Sent by:                                cc:
              
                    pgsql-admin-owner@postgresql.org        Subject:     RE: [ADMIN] Re: Top
              

              

              
                    08/08/01 05:54
              

              

              






-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anyway, it's a combination of ORDER BY and LIMIT:

SELECT * FROM table1 ORDER BY field1 DESC LIMIT 10;

or, if you want the bottom ten:

SELECT * FROM table1 ORDER BY field1 LIMIT 10;

Or, if you want the next ten:

SELECT * FROM table1 ORDER BY field1 LIMIT 10, 10;

or something to that effect.

MikeA

>> -----Original Message-----
>> From: Colin 't Hart [mailto:cthart@yahoo.com]
>> Sent: 08 August 2001 08:17
>> To: pgsql-admin@postgresql.org
>> Subject: [ADMIN] Re: Top
>>
>>
>> > Please, does anyone know if is there in Postgres's SQL language
>> > an equivalent for Oracle's TOP ?
>>
>> Ummm, Oracle's SQL doesn't have a TOP.
>>
>> Are you thinking of SQL Server?
>>
>>
>> Cheers,
>>
>> Colin
>>
>>
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo@postgresql.org
>>

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBO3D+BXympNV/C086EQLevwCgpxcbIiA4OWcjmXQhirB0g4Ts4wEAnjSv
WxaprcluB2uhv5gmtaM6rCbI
=jPE0
-----END PGP SIGNATURE-----


_________________________________________________________________________
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.
__________________________________________________________________________