X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0CAD49FA3A6 for ; Thu, 11 May 2006 00:55:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 99685-06 for ; Thu, 11 May 2006 00:55:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from grzm.com (grzm.com [200.46.204.98]) by postgresql.org (Postfix) with ESMTP id 4BD089F931E for ; Thu, 11 May 2006 00:55:22 -0300 (ADT) Received: from [172.16.1.101] (unknown [61.197.227.146]) by grzm.com (Postfix) with ESMTP id 15A1F161B93B; Thu, 11 May 2006 04:55:20 +0100 (BST) In-Reply-To: <018701c674f2$756133d0$1e21100a@ghwk02002147> References: <018701c674f2$756133d0$1e21100a@ghwk02002147> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: ORDER BY question Date: Thu, 11 May 2006 12:55:19 +0900 To: "Christian Paul Cosinas" X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/97 X-Sequence-Number: 25128 On May 11, 2006, at 21:00 , Christian Paul Cosinas wrote: > For example I have a table like this > > ID Name > 1 A > 1 B > 2 C > 2 D > > And I have a Query like this: > SELECT * FROM table ORDER BY ID. > > Would my result always give me the same order or is there may be a > possible > different result? It may give you a different result: if the order is not explicitly specified by the ORDER BY clause, you are not guaranteed to get the rows back in any particular order. So for cases where you may not be ordering on a unique column (such as above), you may want to do something like: SELECT * FROM table ORDER BY "ID", "Name"; Hope this helps. Michael Glaesemann grzm seespotcode net