Re: [SQL] max (timestamp,timestamp)

2006-11-14 Thread T E Schmitz
Michael Fuhr wrote: On Mon, Nov 13, 2006 at 07:29:09PM +0500, imad wrote: max (timestamptz, timestamptz) does not exist already. You need to create a simple function in PLpgSQL something like if a > b return a; else return b; Since PostgreSQL 8.1 you can use GREATEST: test=> SELECT greates

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread Michael Fuhr
On Mon, Nov 13, 2006 at 07:29:09PM +0500, imad wrote: > max (timestamptz, timestamptz) does not exist already. You need to > create a simple function in PLpgSQL something like > > if a > b > return a; > else > return b; Since PostgreSQL 8.1 you can use GREATEST: test=> SELECT greatest(1, 2); gr

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread imad
max (timestamptz, timestamptz) does not exist already. You need to create a simple function in PLpgSQL something like if a > b return a; else return b; Even an sql function will do the job here using case statement. --Imad www.EntepriseDB.com On 11/13/06, A. Kretschmer <[EMAIL PROTECTED]> wr

Re: [SQL] max (timestamp,timestamp)

2006-11-13 Thread A. Kretschmer
am Mon, dem 13.11.2006, um 13:46:00 + mailte T E Schmitz folgendes: > I tried the following query but the query fails as > "function max (timestamp w. timezone,timestamp w. timezone) does not exist" > > SELECT id, > > MAX(last_updated, > (SELECT MAX (last_updated) FROM product_category_memb

Re: [SQL] max timestamp

2004-05-29 Thread boyd (remove_) [EMAIL PROTECTED]
Michael Sterling wrote: i'm trying to get the max time stamp, from each day, of a range of dates, not just the max time stamp for the complete range dates but for each day. I don't trust the news client I was using. So will answer again from the Netscape version; This worked for me: I have a ta

Re: [SQL] max timestamp

2004-02-16 Thread Denis
Hi Michael, Try this.. ace=> create table test( mytime timestamp ); CREATE ace=> insert into test values (now() ); INSERT 1823542 1 ace=> insert into test values (now() ); INSERT 1823543 1 ace=> insert into test values (now()-1); INSERT 1823544 1 ace=> insert into test values (now()-1); INSERT 18

Re: [SQL] max timestamp

2004-02-15 Thread Bruno Wolff III
On Tue, Feb 10, 2004 at 10:14:04 -0800, Michael Sterling <[EMAIL PROTECTED]> wrote: > i'm trying to get the max time stamp, from each day, of a range of > dates, not just the max time stamp for the complete range dates but > for each day. SELECT DISTINCT ON can probably do what you want. Somethi

Re: [SQL] max timestamp

2004-02-15 Thread Tomasz Myrta
Dnia 2004-02-10 19:14, Użytkownik Michael Sterling napisał: i'm trying to get the max time stamp, from each day, of a range of dates, not just the max time stamp for the complete range dates but for each day. select max(some_time) group by some_time::date or select max(some_time) group by date_tr

Re: [SQL] max timestamp

2004-02-15 Thread Robert Creager
When grilled further on (10 Feb 2004 10:14:04 -0800), [EMAIL PROTECTED] (Michael Sterling) confessed: > i'm trying to get the max time stamp, from each day, of a range of > dates, not just the max time stamp for the complete range dates but > for each day. > Well, one gross and ugly way is: SE

Re: [SQL] max timestamp

2004-02-15 Thread Stephan Szabo
On Tue, 10 Feb 2004, Michael Sterling wrote: > i'm trying to get the max time stamp, from each day, of a range of > dates, not just the max time stamp for the complete range dates but > for each day. Maybe something like? SELECT CAST(timestampcol AS DATE), max(timestampcol) FROM thetable GROUP