Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

where clause in SQL statement

Here is my load statement

LOAD  eventid,

    itemid,

    soldon,

    Year(soldon) as Year,

    Month(soldon) as Month,

    Day(soldon) as Day,

    price;

SQL SELECT *

FROM advast

where soldon>'11/11/2014';

I get an error saying

SQL SELECT *

FROM advast

where soldon>'11/11/2014'

I'm not sure what is wrong with my script, without the WHERE clause it works fine.

Does the where clause just not work in a SQL statement in QV?

1 Solution

Accepted Solutions
MarcoWedel

LOAD  eventid,

    itemid,

    soldon,

    Year(soldon) as Year,

    Month(soldon) as Month,

    Day(soldon) as Day,

    price

where soldon>'11/11/2014';

SQL SELECT *

FROM advast;

should work but could take a longer time to load.

View solution in original post

19 Replies
JonnyPoole
Employee
Employee

It works, but the SQL syntax could be wrong. What data type is soldon in the database ? and what database is this ? (oracle, SQL Server etc...)

jer_2011
Creator II
Creator II

hi,  

apparently this error is obtained.  

ejemplo_14112014.png

already dealt with the connection, ODBC or OLE DB, you must apply before your code 

ejemplo_141120142.png

I leave this link can help

http://community.qlik.com/message/607512#607512

Not applicable
Author

For most of the Sql based databases date has to be in this format '11-Nov-2014'.

Like this it should be, This is a SQL Query successfully executed on a Oracle Database.

Capture.PNG.png

Anonymous
Not applicable
Author

I have an OLE DB connection for Visual FoxPro

I tried to apply the code before the connection, not sure how it's supposed to work but I still get a script error

marcus_malinow
Partner - Specialist III
Partner - Specialist III

You could try using the canonical date format 'YYYY-MM-DD', and see if this works.

It may be that your localisation settings are causing the date to be misinterpreted.

Anonymous
Not applicable
Author

Did anyone apply a successfully where clause on a sql statement in qlikview, does anyone know any documentation on that?

I tried applying a different where clause on a simple numeric field and this format keeps giving me an error

LOAD imach,

    `trans_act`,

    locationid,

    reftrans;

SQL SELECT *

FROM todin

where locationid='22';

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Many of us regularly use where clauses in our QlikView SQL extracts.

In this instance it may be that there's an issue with string / numeric conversion. If your locationid field is numeric, try removing the single quotes from your where clause

marcus_malinow
Partner - Specialist III
Partner - Specialist III

also, remove the single quotes from around 'trans_act'

Anonymous
Not applicable
Author

This worked for the numeric field, removing the single quotes, now I'm working on formatting the date field for my where clause to work