Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

missing expression from SQL

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.

38 Replies
sinanozdemir
Specialist III
Specialist III

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';

chancekbarkley
Partner - Contributor III
Partner - Contributor III

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';

markgraham123
Specialist
Specialist
Author

Max,

Perfect.

it is working.

Thank you very much

markgraham123
Specialist
Specialist
Author

THanq for your time Sinan

markgraham123
Specialist
Specialist
Author

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

markgraham123
Specialist
Specialist
Author

Can i please the format if i wanna use the HH:MI:SS too

for eg: 2015-10-28 05:15:44 PM

chancekbarkley
Partner - Contributor III
Partner - Contributor III

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';

sinanozdemir
Specialist III
Specialist III

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.

maxgro
MVP
MVP

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')

markgraham123
Specialist
Specialist
Author

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.