Re: query

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: query
Дата
Msg-id 20060210061129.GA26002@wolff.to
обсуждение исходный текст
Ответ на query  ("superboy143 (sent by Nabble.com)" <lists@nabble.com>)
Ответы Re: query
Список pgsql-sql
On Tue, Feb 07, 2006 at 01:45:50 -0800, "superboy143 (sent by Nabble.com)" <lists@nabble.com> wrote:
> 
> I have a table in which I have a field with format like 100101. It has many values like 100101, 100102, 100103,
100201,100202, 100301. I have to write a query such that I have to get only distinct values such that they contain only
thesubstring I need. If I give 10 as substring, then it should return only 100101 or 100102 but not both i.e if the
lasttwo characters are not same it should not return both of them. It should return only values starting with 10 the
middletwo values should be distinct and the last two characters may be anything.
 

You can probably use the Postgres extension DISTINCT ON to do what you want.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "BigSmoke"
Дата:
Сообщение: Re: unique constraint instead of primary key? what
Следующее
От: "superboy143 (sent by Nabble.com)"
Дата:
Сообщение: date