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

Where Clause

I'm trying to use the Where Clause to only select the last two years but keep getting error message.

10 Replies
MayilVahanan

HI

Qlikview is case sensitive.

SO, Please check year field..

YEAR or Year or year? And also is Year field available in db?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Sorry the dummy question, but are you sure the year field in the where clause is exactly writen as existing in the db you are loading?

Not applicable
Author

the field is "DATESUBMITTOOPEN" and the Format is MM-DD-YYYY HH:MM:SS AM but i want to select just the last two years. is this possible?

MayilVahanan

HI

Try like this

Select * From tableName where Year(DATESUBMITTOOPEN) >= 2010 and Year(DATESUBMITTOOPEN) <= 2012;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Sure it's possible, but you need to transform your data first in order to create a year reference.

you can try the following:

Select *

From YourTable

Where Year(DateSubMitToOpen)>=xxxx and Year(DateSubMitToOpen)<yyyy

The xxxx and yyyy are the year values you are using as the min and max timestamp values you want to load

If you need a more automated load script then some more steps are required

Regards

Not applicable
Author

Error1.JPG

MayilVahanan

HI

Can you say, did u use any YEAR field or set in any variable in your script?

There is no error in the script, it work fine. Can you provide a script which you are using?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Yes Year(DateSubMitToOpen) as DateSubMitToOpen

MayilVahanan

HI

Its difficult to say without your script.

Try like this

Generally load all the data, like this

Load Year(DateField) as Year, FieldName1,FieldName2;

Select * from tableName where Year(DateField) >= 2010 and Year(DateField) <= 2012;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.