Re: [SQL] How do you write this query?

2002-10-31 Thread Jean-Luc Lachance
Thank goodness for nested select! select data1 from test where data2 = ( select distinct data2 from test where data1 = 'pooh') and data = 3; JLL Richard Huxton wrote: On Thursday 31 Oct 2002 6:21 pm, Wei Weng wrote: data | data1 | data2 --+---+--- 1 | foo | bar

[SQL] How do you write this query?

2002-10-31 Thread Wei Weng
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

Re: [SQL] How do you write this query?

2002-10-31 Thread Richard Huxton
On Thursday 31 Oct 2002 6:21 pm, Wei Weng wrote: 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

Re: [SQL] How do you write this query?

2002-10-31 Thread Achilleus Mantzios
On 31 Oct 2002, Wei Weng wrote: and yet another equivalent query: SELECT f1.data1 from test f1,test f2 where f1.data=3 and f1.data2 = f2.data2 and f2.data1='pooh'; I have a table Table test Column|Type| Modifiers