Re: [SQL] select distinct and order by

2004-04-28 Thread Stijn Vanroye
he help, Stijn Vanroye -Original Message- From: Viorel Dragomir [mailto:[EMAIL PROTECTED] Sent: woensdag 28 april 2004 11:54 To: Stijn Vanroye; [EMAIL PROTECTED] Subject: Re: [SQL] select distinct and order by I don't know if this will work, but why not try it ? :) select distinc

Re: [SQL] select distinct and order by

2004-04-28 Thread Viorel Dragomir
know :) - Original Message - From: Stijn Vanroye To: [EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 12:27 Subject: [SQL] select distinct and order by Hello everybody,I have a short question:I'm trying to run the following query:select distinct on (staff_id) staff_id,

[SQL] select distinct and order by

2004-04-28 Thread Stijn Vanroye
Hello everybody, I have a short question: I'm trying to run the following query: select distinct on (staff_id) staff_id, fullname, loginname from staff where staff_id in (select staff_id from staffmembership where staffgroup_id=#SomeIdValue#) order by fullname I get the follwing error: select

Re: [SQL] Select distinct and order by.

2001-07-17 Thread Tom Lane
Carlos <[EMAIL PROTECTED]> writes: > Select distinct field1, field2 from table1 order by field3; > The value return by PQresultErrorMessage is: > For SELECT DISTINCT, ORDER BY expressions must appear in target list > Whatever this query works fine in postgresql 6.5.3. > Is correct this query a

Re: [SQL] Select distinct and order by.

2001-07-17 Thread Tod McQuillin
On Wed, 11 Jul 2001, Carlos wrote: > Select distinct field1, field2 from table1 order by field3; > > The value return by PQresultErrorMessage is: > > For SELECT DISTINCT, ORDER BY expressions must appear in target list That's because this query is ambiguous. What if table1 looks like this: fie

[SQL] Select distinct and order by.

2001-07-17 Thread Carlos
Hi all: We have developed an aplication in C with postgresql, using libpq. Our version of development is Postgresql 6.5.3 and it works fine. Now we are migrating the application to various flavours of Linux (S.u.s.e 7.1, tha uses postgresql 7.0.3; Debian Potato, that uses postgresql 7.0.2) and