Hi,

Can someone please tell me which of these two queries gives the correct result 
and which one the incorrect?

/* * * *
 *      dT in days for 1000 samples
 */

//      2.922 (&)
with A1 as ( select make_interval (0, 0, 0, 0, 0, 0, ( extract ( epoch from 
interval '8 years' ) / 1000 ) ) as "00" ) select ( extract ( hours from "00" ) +
extract ( minutes from "00" ) / 60 + extract ( seconds from "00" ) / 3600 ) / 
24 as dT from A1;

//      2.88  (X)
with A1 as ( select interval '8 years' / 1000 as "00" ) select extract ( days 
from "00" ) + extract ( hours from "00" ) / 24 + extract ( minutes from "00" ) /
1440 + extract ( seconds from "00" ) / 86400 as dT from A1;

Personally I think only the first one gives the correct answer.

Best regards,
Mischa.



Reply via email to