Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to extract only records from a particular year

Hi, how do I extract records for the year 2012 based on a column with the datatype 'DD/MM/YYYY hh:mm:ss'?? Thanks.

6 Replies
senpradip007
Specialist III
Specialist III

Try this,

Load

     *

From <Source Table>

where Year(DateTime) = 2012;

Not applicable
Author

Hi, apparently i cant use year(Field) = 2012. this is what i did:

sql select

.

.(other fields)

.

statusdate.

.

.

from <filename> where year(statusdate)=2012;

an error message stated that 'year' is an invalid identifier...

senpradip007
Specialist III
Specialist III

Can you upload sample qvw?

jonathandienst
Partner
Partner

Hi

This is because everything after the SQL command is executed by the database server, not by Qlikview. If you are using MS SQL Server, then the command would be

     WHERE DatePartr(yy, statusdate) = 2012

Other databases would need a different expression.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jagan
MVP
MVP

Hi,

Try like this

LOAD

*

WHERE Year(statusdate) = 2012;

sql select

.

.(other fields)

.

statusdate.

.

.

from <filename> ;

Regards,

Jagan.

satyadev_j
Specialist
Specialist

Try below,


LOAD *

WHERE Year(statusdate)=2012;

SELECT *

FROM <filename>;

Thanks