How do you write this query?

Поиск
Список
Период
Сортировка
От Wei Weng
Тема How do you write this query?
Дата
Msg-id 1036088486.13986.19.camel@Monet
обсуждение исходный текст
Ответы Re: How do you write this query?
Re: How do you write this query?
Список pgsql-sql
I have a table 
                Table "test"
Column    |            Type        | Modifiers
--------+------------------------+----------
data    | integer                | not null 
data1   | character varying(128) | not null
data2   | character varying(128) | not null

(Note: data is NOT the primary key.)

And 
select * from test 
returns

data | data1 | data2 
------+-------+-------   1 | foo   | bar    2 | greg  | bar   3 | pooh  | bar   4 | dah   | peng

I need a query that returns me the "data1" that satisfies the logic of
the following pseudo code:

1: select data2 into @out from test where data1 = 'pooh'
2: select data1 from test where data2 = @out and data = 3


What do I do?

Thanks!

-- 
Wei Weng
Network Software Engineer
KenCast Inc.




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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Returning a recordset and filling datatable in a .NET
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: How do you write this query?