drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <sanjiv...@yahoo.com.INVALID>
Subject Converting Date to Timestand
Date Wed, 18 Jan 2017 15:18:05 GMT
Hello I am using Drill latest version (1.9) in window in embedded mode.
I am trying to convert Date to Timestand. While Coverting I am using following query:-
SELECT  T5.`Name` AS `Website Name`,  T5.`Description` AS `Description`,TO_CHAR((CAST(T5.`CreateOn`
AS TIMESTAMP)), 'MM-dd-yyyy hh:mm:ss a') AS `CreateOn` FROM <plugingName>.<schemaName>.<tableName1>
AS T4 INNER JOIN <plugingName>.<schemaName>.<tableName2>AS T5 ON T5.`ID`
= T4.`WebsiteID`
NOTE:- IN MY DATABASE CREATEDON DATA IS LIKE  2017-01-05 08:09:17.020
O/p:- If I used this query CreatedOn Column Converted Successfully, but My WEBSITENAME Columns
showing null values.. Website Name Description CreateOnnull  Hoostonicsas  01-05-2017 08:09:17
AMnull  Horotonicssd 01-05-2017 08:09:17 AMnull  Hodsodtonics  01-05-2017 08:09:17 AMnull
 Hodtotonics  01-05-2017 08:09:17 AMnull  Hooewrtonics  01-05-2017 08:09:17 AMnull  Hohhotonics
 01-05-2017 08:09:17 AM
But I remove TO_CHAR((CAST(T5.`CreateOn` AS TIMESTAMP)), 'MM-dd-yyyy hh:mm:ss a') AS `CreateOn`
Column from Select query Output showing fine.
Please Tell me what i am doing wrong? And How to Convert (2017-01-05 08:09:17.020) data to
(01-05-2017 08:09:17 AM).??
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message