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




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to