liu ming created TRAFODION-3025:
-----------------------------------

             Summary: order by clause in subquery does not work 
                 Key: TRAFODION-3025
                 URL: https://issues.apache.org/jira/browse/TRAFODION-3025
             Project: Apache Trafodion
          Issue Type: Task
            Reporter: liu ming
            Assignee: liu ming


CREATE TABLE TRAFODION.SEABASE.DT
  (
    D1 DATE DEFAULT NULL NOT SERIALIZED
  , T1 TIME(0) DEFAULT NULL NOT SERIALIZED
  , TS1 TIMESTAMP(2) DEFAULT NULL NOT SERIALIZED
  , TS2 TIMESTAMP(6) DEFAULT NULL NOT SERIALIZED
  )
ATTRIBUTES ALIGNED FORMAT NAMESPACE 'TRAF_RSRVD_3'
;
insert into dt values(current_date,current_time,current_timestamp, 
current_timestamp);
.............
.............

>>select * from dt;
D1 T1 TS1 TS2 
---------- -------- ---------------------- --------------------------
2018-03-27 14:44:36 2018-03-27 14:44:36.80 2018-03-27 14:44:36.808913
2018-04-16 12:08:37 2018-04-16 12:08:37.92 2018-04-16 12:08:37.922973
2018-04-16 12:08:39 2018-04-16 12:08:39.53 2018-04-16 12:08:39.530414
2018-04-16 12:08:40 2018-04-16 12:08:40.63 2018-04-16 12:08:40.634867
2018-04-16 12:08:42 2018-04-16 12:08:42.06 2018-04-16 12:08:42.069282
2018-04-16 12:08:42 2018-04-16 12:08:42.97 2018-04-16 12:08:42.971260
2018-04-16 12:08:43 2018-04-16 12:08:43.81 2018-04-16 12:08:43.812465
2018-04-16 12:08:44 2018-04-16 12:08:44.57 2018-04-16 12:08:44.578473
2018-04-16 12:08:45 2018-04-16 12:08:45.24 2018-04-16 12:08:45.240684
2018-04-16 12:08:45 2018-04-16 12:08:45.92 2018-04-16 12:08:45.923487
2018-04-16 12:08:46 2018-04-16 12:08:46.62 2018-04-16 12:08:46.623653
--- 11 row(s) selected.

>>select * from dt order by ts1 desc;
D1 T1 TS1 TS2 
---------- -------- ---------------------- --------------------------
2018-04-16 12:08:46 2018-04-16 12:08:46.62 2018-04-16 12:08:46.623653
2018-04-16 12:08:45 2018-04-16 12:08:45.92 2018-04-16 12:08:45.923487
2018-04-16 12:08:45 2018-04-16 12:08:45.24 2018-04-16 12:08:45.240684
2018-04-16 12:08:44 2018-04-16 12:08:44.57 2018-04-16 12:08:44.578473
2018-04-16 12:08:43 2018-04-16 12:08:43.81 2018-04-16 12:08:43.812465
2018-04-16 12:08:42 2018-04-16 12:08:42.97 2018-04-16 12:08:42.971260
2018-04-16 12:08:42 2018-04-16 12:08:42.06 2018-04-16 12:08:42.069282
2018-04-16 12:08:40 2018-04-16 12:08:40.63 2018-04-16 12:08:40.634867
2018-04-16 12:08:39 2018-04-16 12:08:39.53 2018-04-16 12:08:39.530414
2018-04-16 12:08:37 2018-04-16 12:08:37.92 2018-04-16 12:08:37.922973
2018-03-27 14:44:36 2018-03-27 14:44:36.80 2018-03-27 14:44:36.808913
--- 11 row(s) selected.

>>select * from (select * from dt order by ts1 desc); 
D1 T1 TS1 TS2 
---------- -------- ---------------------- --------------------------
2018-03-27 14:44:36 2018-03-27 14:44:36.80 2018-03-27 14:44:36.808913
2018-04-16 12:08:37 2018-04-16 12:08:37.92 2018-04-16 12:08:37.922973
2018-04-16 12:08:39 2018-04-16 12:08:39.53 2018-04-16 12:08:39.530414
2018-04-16 12:08:40 2018-04-16 12:08:40.63 2018-04-16 12:08:40.634867
2018-04-16 12:08:42 2018-04-16 12:08:42.06 2018-04-16 12:08:42.069282
2018-04-16 12:08:42 2018-04-16 12:08:42.97 2018-04-16 12:08:42.971260
2018-04-16 12:08:43 2018-04-16 12:08:43.81 2018-04-16 12:08:43.812465
2018-04-16 12:08:44 2018-04-16 12:08:44.57 2018-04-16 12:08:44.578473
2018-04-16 12:08:45 2018-04-16 12:08:45.24 2018-04-16 12:08:45.240684
2018-04-16 12:08:45 2018-04-16 12:08:45.92 2018-04-16 12:08:45.923487
2018-04-16 12:08:46 2018-04-16 12:08:46.62 2018-04-16 12:08:46.623653

--- 11 row(s) selected. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to