Re: [SQL] Select + min question

2002-06-24 Thread Devrim GUNDUZ
Hi, On Sun, 23 Jun 2002, Christopher Kings-Lynne wrote: > > Use a subselect (and don't compare to 't' if it's a boolean field...) > > SELECT b_date FROM test WHERE active AND id=(SELECT min(id) FROM test) LIMIT > 1; It'a a shame for me that I could not think of using subselects :-( Anyway, t

Re: [SQL] Select + min question

2002-06-23 Thread Mathieu Arnold
--On Sunday, June 23, 2002 14:36:14 +0300 Devrim GUNDUZ <[EMAIL PROTECTED]> wrote: > > Hi, > > I have created a table like this: > > CREATE TABLE test ( > b_date char(8), > active boolean, > id serial > ); > > and inserted some rows. > > Now, what I want is to select the

Re: [SQL] Select + min question

2002-06-23 Thread Christopher Kings-Lynne
> Now, what I want is to select the b_date which has the minimum "id" and > active=t. > > A normal query would be : > SELECT b_date,min(id) FROM test WHERE active='t' GROUP BY id LIMIT 1 > > However, I only want to select b_date. So, if I perform the following > query, I get the following error:

[SQL] Select + min question

2002-06-23 Thread Devrim GUNDUZ
Hi, I have created a table like this: CREATE TABLE test ( b_date char(8), active boolean, id serial ); and inserted some rows. Now, what I want is to select the b_date which has the minimum "id" and active=t. A normal query would be : SELECT b_date,min(id)