[SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Andreas Joseph Krogh
Hi all. Any hint on how to format this interval as number of hour/seconds etc? select age('2007-09-22 17:00'::timestamp, '2000-02-20 18:00'::timestamp); age --- 7 years 7 mons 1 day 23:00:00 -- Andreas Joseph Krogh <[EMAIL PROTECTED]> Senior Software Dev

Re: [SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Andreas Kretschmer
Andreas Joseph Krogh <[EMAIL PROTECTED]> schrieb: > Hi all. Any hint on how to format this interval as number of hour/seconds etc? > select age('2007-09-22 17:00'::timestamp, '2000-02-20 18:00'::timestamp); > age > --- > 7 years 7 mons 1 day 23:00:00 You

Re: [SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Andreas Joseph Krogh
On Sunday 16 September 2007 13:14:27 Andreas Kretschmer wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> schrieb: > > Hi all. Any hint on how to format this interval as number of hour/seconds > > etc? select age('2007-09-22 17:00'::timestamp, '2000-02-20 > > 18:00'::timestamp); age > > ---

Re: [SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > On Sunday 16 September 2007 13:14:27 Andreas Kretschmer wrote: >> You can use extract(epoch, from ...) like this: >> >> test=*# select extract(epoch from '2007-09-22 17:00'::timestamp) - extract >> (epoch from '2000-02-20 18:00'::timestamp); ?colu

Re: [SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Shane Ambler
Andreas Joseph Krogh wrote: On Sunday 16 September 2007 13:14:27 Andreas Kretschmer wrote: Andreas Joseph Krogh <[EMAIL PROTECTED]> schrieb: Hi all. Any hint on how to format this interval as number of hour/seconds etc? select age('2007-09-22 17:00'::timestamp, '2000-02-20 18:00'::timestamp); a

Re: [SQL] Format intervall as hours/minutes etc

2007-09-16 Thread Andreas Joseph Krogh
On Sunday 16 September 2007 17:41:56 Tom Lane wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > > On Sunday 16 September 2007 13:14:27 Andreas Kretschmer wrote: > >> You can use extract(epoch, from ...) like this: > >> > >> test=*# select extract(epoch from '2007-09-22 17:00'::timestamp)

Re: [SQL] Extracting hostname from URI column

2007-09-16 Thread Paul Lambert
Paul Lambert wrote: chester c young wrote: I'm trying to use substr() and position() functions to extract the full host name (and later a domain) from a column that holds URLs. substring( href from '.*://\([^/]*)' ); Ok, your solution looks better than mine... but I have no idea how to int

Re: [SQL] Extracting hostname from URI column

2007-09-16 Thread Gregory Stark
"Paul Lambert" <[EMAIL PROTECTED]> writes: > What would be the best way to do something like that? I assume it won't be a > simple regex like the above due to the country codes on the end of some > domains. My thought is look at the last portion of the domain, if it's 2 > characters long then assu