Hi Support,
Can you please tell me why I am getting different output from these queries.I know the flightStartDate is not a TimestampTZ field in first table, but the CASE statement doesnt goto ELSE part in both these query.
drop table TimeZoneTestTable;
create table TimeZoneTestTable (adId int, flightStartDate timestamp);
insert into TimeZoneTestTable values(1,'2013-10-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-11-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-02 13:00:00');
insert into TimeZoneTestTable values(1,'2014-11-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-22 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-12 13:00:00');
select case when to_timestamptz(1383451200) at timezone 'EST5EDT' > min(flightStartDate) at timezone 'EST5EDT' then to_timestamptz(1383451200) at timezone 'EST5EDT' else min(flightStartDate) at timezone 'EST5EDT' end as startDate
from TimeZoneTestTableTimeZoneTestTable
group by adId;
drop table TimeZoneTestTable;
create table TimeZoneTestTable (adId int, flightStartDate timestamptz);
insert into TimeZoneTestTable values(1,'2013-10-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-11-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-02 13:00:00');
insert into TimeZoneTestTable values(1,'2014-11-02 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-22 13:00:00');
insert into TimeZoneTestTable values(1,'2013-12-12 13:00:00');
select case when to_timestamptz(1383451200) at timezone 'EST5EDT' > min(flightStartDate) at timezone 'EST5EDT' then to_timestamptz(1383451200) at timezone 'EST5EDT' else min(flightStartDate) at timezone 'EST5EDT' end as startDate
from TimeZoneTestTable
group by adId;
Thanks
Ramesh
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.