Re: [SQL] select distinct and order by

2004-04-28 Thread Stijn Vanroye
I solved it. Your first answer gave me a slap on the head (and by god I needed one :-) ). I simply used this: select distinct staff_id, fullname, loginname from staff where staff_id in (select staff_id from staffmembership where staffgroup_id=#someid#) order by fullname By omitting the on(sta

Re: [SQL] select distinct and order by

2004-04-28 Thread Viorel Dragomir
I don't know if this will work, but why not try it ? :)   select distinct fullname, distinct staff_id, loginname from staffwhere staff_id in   (select staff_id from staffmembership where staffgroup_id=#SomeIdValue#)order by fullname, staff_id     Next one is more complicate but with more chan

[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] date arithmetic over calender year boundaries

2004-04-28 Thread Bruno Wolff III
On Wed, Apr 28, 2004 at 16:12:34 +1200, Ray Jackson <[EMAIL PROTECTED]> wrote: > Hi, > > The following Postgres 7.1 query extracts aggregated data for an > arbitrary period within each year for sites in a table containing > 30 years of temperature data. It isn't completely clear what you want t