Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to fetch the records which were greater than 10/28/2015 05:10:55 PM from SQL through qlikview script.
I have field "Last updated Date time" which holds that value.
But when i use,
SQL SELECT
*
FROM Table WHERE DATETIME(LAST_UPDATE_DATETIME) >='10/28/2015';
It's throwing "missing expression from SQL" error.
Can some one please help me to get into the right format.
I am not familiar with Oracle SQL, but I don't see any DateTime() in the list of Oracle SQL functions. However, can you try the below?
SQL SELECT
*
FROM "Grade"."Dealers" Where Cast((LAST_UPDATE_DATETIME) As Date)>= '2015-10-28';
Mark,
Give this a shot...
SQL SELECT *
FROM "Grade"."Dealers"
Where TO_CHAR(LAST_UPDATE_DATETIME,'YYYY-MM-DD hh:mi:ss') >= '2015-10-28';
Max,
Perfect.
it is working.
Thank you very much
THanq for your time Sinan
Chance, its working.
Can i please the format if i wanan use the HH:MI:SS too
for eg: 2015-10-28 05:15:44 PM
Can i please the format if i wanna use the HH:MI:SS too
for eg: 2015-10-28 05:15:44 PM
Sure, i believe the syntax would be as follows:
SQL SELECT *
FROM "Grade"."Dealers"
Where TO_CHAR(LAST_UPDATE_DATETIME,'YYYY-MM-DD hh:mi:ss PM') >= '2015-10-28 05:15:44 PM';
Hey Mark,
One way to do is using TO_CHAR() function
TO_CHAR(LAST_UPDATE_DATETIME, 'YYYY-MM-DD HH:MI:SS PM')
Hope this helps.
Can i please the format if i wanna use the HH:MI:SS too
for eg: 2015-10-28 05:15:44 PM
I think
WHERE LAST_UPDATE_DATETIME > to_date('28/10/2015 17:15:44', 'DD/MM/YYYY HH24:MI:SS')
or
WHERE UPDATEDATE > to_date('28/10/2015 05:15:44 PM', 'DD/MM/YYYY HH:MI:SS AM')
Max,
Please ignore the previous post.
to_date('28/10/2015 05:15:44 PM', 'DD/MM/YYYY HH:MI:SS AM') is working.
I was just confused how can it bring all records greater than 05:15:44 PM when we mention AM in the format.
Just eager to know.