Re: [SQL] Counting Distinct Records

2004-11-17 Thread Thomas F . O'Connell
The specific problem I'm trying to solve involves a user table with some history. Something like this: create table user_history ( user_id int event_time_stamp timestamp ); I'd like to be able to count the distinct user_ids in this table, even if it were joined to other tables.

Re: [SQL] session_id

2004-11-17 Thread Michael Fuhr
On Wed, Nov 17, 2004 at 06:25:25AM -0800, Riccardo G. Facchini wrote: > > --- Richard Huxton <__> wrote: > > > > Add a new sequence to your database: [snip] > Good idea, but it won't work for what I need. > I'll be able to do get the nextval('my_session_id') as soon as the > session initiates, b

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
Riccardo G. Facchini wrote: Add a new sequence to your database: CREATE SEQUENCE my_session_id; Then, at the start of every session: SELECT nextval('my_session_id'); and whenever you need the value: SELECT currval('my_session_id'); Good idea, but it won't work for what I need. I'll be able t

Re: [SQL] session_id

2004-11-17 Thread Riccardo G. Facchini
--- Richard Huxton <__> wrote: > Achilleus Mantzios wrote: > > O Richard Huxton Ýãñáøå óôéò Nov 17, 2004 : > > > > > >>Riccardo G. Facchini wrote: > >> > >>>hi all, > >>> > >>>is there a way to determine the session id on a database session? > >>> > >>>I would need to have a unique number whene

Re: [SQL] Counting Distinct Records

2004-11-17 Thread Stephan Szabo
On Tue, 16 Nov 2004, Thomas F.O'Connell wrote: > Hmm. I was more interested in using COUNT( * ) than DISTINCT *. > > I want a count of all rows, but I want to be able to specify which > columns are distinct. I'm now a bit confused about exactly what you're looking for in the end. Can you give a s

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
Achilleus Mantzios wrote: O Richard Huxton έγραψε στις Nov 17, 2004 : Riccardo G. Facchini wrote: hi all, is there a way to determine the session id on a database session? I would need to have a unique number whenever a session is started, and have this available as a function or view result. Why

Re: [SQL] session_id

2004-11-17 Thread Riccardo G. Facchini
--- Achilleus Mantzios <__> wrote: > O Richard Huxton Ýãñáøå óôéò Nov 17, 2004 : > > > Riccardo G. Facchini wrote: > > > hi all, > > > > > > is there a way to determine the session id on a database session? > > > > > > I would need to have a unique number whenever a session is > started, and >

Re: [SQL] session_id

2004-11-17 Thread Riccardo G. Facchini
--- Richard Huxton <__> wrote: > Riccardo G. Facchini wrote: > > hi all, > > > > is there a way to determine the session id on a database session? > > > > I would need to have a unique number whenever a session is started, > and > > have this available as a function or view result. > > Add a n

Re: [SQL] session_id

2004-11-17 Thread Achilleus Mantzios
O Richard Huxton έγραψε στις Nov 17, 2004 : > Riccardo G. Facchini wrote: > > hi all, > > > > is there a way to determine the session id on a database session? > > > > I would need to have a unique number whenever a session is started, and > > have this available as a function or view result. W

Re: [SQL] session_id

2004-11-17 Thread Richard Huxton
Riccardo G. Facchini wrote: hi all, is there a way to determine the session id on a database session? I would need to have a unique number whenever a session is started, and have this available as a function or view result. Add a new sequence to your database: CREATE SEQUENCE my_session_id; Then,

[SQL] session_id

2004-11-17 Thread Riccardo G. Facchini
hi all, is there a way to determine the session id on a database session? I would need to have a unique number whenever a session is started, and have this available as a function or view result. thanks. ---(end of broadcast)--- TIP 8: explain

Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Oleg Bartunov
On Wed, 17 Nov 2004, Achilleus Mantzios wrote: O Oleg Bartunov ?? Nov 17, 2004 : Gary, if you need really fast solution for you task and dont't afraid non-standard soltion, take a look on contrib/ltree module. http://www.sai.msu.su/~megera/postgres/gist/ltree/ Oleg Oleg how would you co

Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Achilleus Mantzios
O Oleg Bartunov έγραψε στις Nov 17, 2004 : > Gary, > > if you need really fast solution for you task and dont't afraid > non-standard soltion, take a look on contrib/ltree module. > http://www.sai.msu.su/~megera/postgres/gist/ltree/ > > Oleg Oleg how would you compare an ltree solution a

Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Oleg Bartunov
Gary, if you need really fast solution for you task and dont't afraid non-standard soltion, take a look on contrib/ltree module. http://www.sai.msu.su/~megera/postgres/gist/ltree/ Oleg On Wed, 17 Nov 2004, Gary Stainburn wrote: On Tuesday 16 November 2004 1:08 pm, sad wrote: On Tuesday 16