Re: [GENERAL] Result of ORDER-BY

2011-11-18 Thread Good Day Books
> The query as shown does't actually have an ORDER BY clause in it;
> did you write GROUP BY where you meant ORDER BY?

Thank you for your reply. I tried all combinations
- GROUP BY
- ORDER BY
- GROUP BY & ORDER BY
the result is always the same.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Result of ORDER-BY

2011-11-18 Thread Good Day Books
> See the other remark in this thread about GROUP BY and ORDER BY.  Note
> that GROUP BY used to cause ORDER BY every time, because it was always
> implemented with a sort.  That hasn't been true for several releases,
> and if you're relying on that side effect it could be the cause of
> this, although it's pretty surprising that you still got A, B, C in
> that case.  In any case, you definitely need an ORDER BY category
> here, too.  Does that make a difference?
> 
> You might also want to look at your collation.  Sort orders are
> notorious for being surprising across collations.  What's this one?

Thank you very much for your reply. Yes, I tried ORDER BY, and the result
is the same.

I am not sure about collations; I guess I will have to read up on this
subject.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Result of ORDER-BY

2011-11-17 Thread Good Day Books
[PostgreSQL 8.3.9]

I have a query, as follows

SELECT DISTINCT ON(category) category
FROM gdb_books
WHERE category LIKE 'Fiction%'
GROUP BY category

The (partial) result is this:
...
# Fiction - General (A)
# Fiction - General - Anthologies
# Fiction - General (B)
# Fiction - General (C)
# Fiction - General (D)
...

I would have expected '- Anthologies' to be either at the top, or at the bottom 
of the result.

Does anyone have an explanation why this is not so; are the special characters 
(parenthesis, hyphen) just ignored?  If so, is there a way to force ORDER BY to 
include the special characters in the sort?

Thank you for any reply.
Pat Willener
GDB Tokyo


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general