RB Smissaert wrote:
Thanks, it is getting close, but it doesn't quite work.
For example this:
select
case
when date('2002-12-22', '+' ||
strftime('%Y', 'now') - strftime('%Y', '2002-12-22') ||
' years') >= date('now')
then strftime('%Y', 'now') - strftime('%Y', '2002-12-22')
else strftime('%Y', 'now') - strftime('%Y', '2002-12-22') -1
end
as age
Gives 3
Oops, I needed another set of brackets to ensure correct order of
operations, and I had the comparison wrong (need <= not >=).
This works:
select
case
when date('2002-12-22', '+' ||
(strftime('%Y', 'now') - strftime('%Y', '2002-12-22')) ||
' years') <= date('now')
then strftime('%Y', 'now') - strftime('%Y', '2002-12-22')
else strftime('%Y', 'now') - strftime('%Y', '2002-12-22') -1
end
as age
HTH
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------