distinct + order by
От | t-ishii@sra.co.jp (Tatsuo Ishii) |
---|---|
Тема | distinct + order by |
Дата | |
Msg-id | 199811072353.IAA29308@meshsv26.tk.mesh.ad.jp обсуждение исходный текст |
Ответы |
Re: [HACKERS] distinct + order by
|
Список | pgsql-hackers |
6.4 allows to use ORDER BY with a column that does not appear in a target list. This is great. However, following result seems strange to me. Sometimes DISTINCT does not remove duplication. Is this normal behavior? create table dtest (i text, j date, k int); CREATE insert into dtest values ('a', '1998/12/1', 1); INSERT 215243 1 insert into dtest values ('a', '1998/12/2', 2); INSERT 215244 1 insert into dtest values ('a', '1998/12/3', 3); INSERT 215245 1 select * from dtest; i| j|k -+----------+- a|12-01-1998|1 a|12-02-1998|2 a|12-03-1998|3 (3 rows) select distinct i from dtest; i - a (1 row) select distinct i from dtest order by j; i - a a a (3 rows) select distinct i from dtest order by k; i - a a a (3 rows) -- Tatsuo Ishii t-ishii@sra.co.jp
В списке pgsql-hackers по дате отправления: