[Cialug] SQL wizardry possible?

Claus cniesen at gmx.net
Tue Oct 30 16:59:12 CDT 2007

On 10/30/2007 4:40 PM, Jeffrey C. Ollie wrote:
> Completely untested, but:
> select pref_uid,pref_value from horde_prefs where pref_name = 'last_login' and age(to_timestamp(to_number(substring(pref_value from 'i:([0-9]+);'))) < interval '6 months';
> http://www.postgresql.org/docs/8.2/interactive/functions-string.html
> http://www.postgresql.org/docs/8.2/interactive/functions-datetime.html
> Jeff

FYI: "substr" are supported by DB2 and Oracle (it's probably part of 
SQL).  I'm not sure about substring and other weird things that have 
been suggested so far. Of course assuming the embedded time stamp is 
always at the same position.  Otherwise you are screwed trying to do 
anything SQL compliant.

More information about the Cialug mailing list