Re: how to do this select?

Поиск
Список
Период
Сортировка
От Yi Zhao
Тема Re: how to do this select?
Дата
Msg-id 1235027384.3155.21.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: how to do this select?  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: how to do this select?  (Craig Ringer <craig@postnewspapers.com.au>)
Re: how to do this select?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-general
thanks Ringer.
my mean is that:
I want less than 2 rows which have the same value of column "b"!

for example, there is 3 columns have the same value "A",
 X | A
 X | A
 Y | A
I want my result have two of them.

thanks.
On Thu, 2009-02-19 at 15:49 +0900, Craig Ringer wrote:
> Yi Zhao wrote:
>
> > I want to get the only 2 rows(limit or random) if the column "b" have
> > the same value. so, the result of the above is
> > a | b
> > ---+---
> > X | A
> > X | A
> > D | B
> > H | B
> > P | C
> >
> > how to do that, thanks all!
> >
> >
>
> I don't understand what you want based on your description and your
> example results. What do you mean by "if the column `b' have the same
> value" ?
>
>
> By the way, when you're posting this kind of question it's really
> helpful to send SQL code to set up your test environment. For example,
> if you had sent:
>
>
> CREATE TABLE ab (a text, b text);
>
> INSERT INTO ab (a,b) VALUES
> ('X','A'),('X','B'),('Y','A'),('D','B'),('H','B'),('E','B'),('D','B'),('P','C');
>
>
>
> ... then it would've saved the hassle of assembling a test table.
>
> --
> Craig Ringer
>


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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: how to do this select?
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: how to do this select?