Discussion Board for collaboration on QlikView Scripting.
I'm trying to use the Where Clause to only select the last two years but keep getting error message.
Qlikview is case sensitive.
SO, Please check year field..
YEAR or Year or year? And also is Year field available in db?
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?
the field is "DATESUBMITTOOPEN" and the Format is MM-DD-YYYY HH:MMS AM but i want to select just the last two years. is this possible?
Try like this
Select * From tableName where Year(DATESUBMITTOOPEN) >= 2010 and Year(DATESUBMITTOOPEN) <= 2012;
Sure it's possible, but you need to transform your data first in order to create a year reference.
you can try the following:
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
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?
Yes Year(DateSubMitToOpen) as DateSubMitToOpen
Its difficult to say without your script.
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;