Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
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
Not applicable

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

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
Not applicable

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

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
Not applicable

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