Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

loading data with filter from SQL

Hiya

i need to load data with filter from SQL into qlik sense

i need to load data from a specific date range only

e.g from 2005 to present

i have found on forum how to do this for txt file (but i need to do this for SQL) ... but only for between to dates. but i need 2005 to present

Loading data with filter on date 

please help

Kind Regards

Joeybird

1 Solution

Accepted Solutions
maxgro
MVP
MVP

try

let vstart='20150101';

let vend=date(Today(), 'YYYYMMD');

LOAD *;

SQL SELECT *

FROM somesqlservertable

where dat_data >= '$(vstart)' and dat_data <= '$(vend)'

;

View solution in original post

6 Replies
maxgro
MVP
MVP

try

let vstart='20150101';

let vend=date(Today(), 'YYYYMMD');

LOAD *;

SQL SELECT *

FROM somesqlservertable

where dat_data >= '$(vstart)' and dat_data <= '$(vend)'

;

Not applicable

Hi,

Here's some examples :

Oracle : WHERE MyDate BETWEEN TO_DATE('01/01/2005','mm/dd/yyyy') AND SYSDATE

Sql Server 2012 : WHERE MyDate >= CAST('01/01/2005' AS DATE) AND MyDate <= GETDATE()

Xavier.

joeybird
Creator III
Creator III
Author

Hiya

this worked fab, but would like to as well only 2005 load e.g certain departments data criteria too from SQL?

I have this to get my drop down

if(Wildmatch([DepartmentCode], '*999'), [Department]) as [Department],

how would I use this to only load in certain department data too?

Kind Regards

Joeybird

joeybird
Creator III
Creator III
Author


Hiya

I meant to say

if(Wildmatch([DepartmentCode], '*999'), [Department]) as [DepartmentDropDown],

please help

Kind Regards

Joeybird

maxgro
MVP
MVP

filter in Qlik

LOAD *

where wildmatch([DepartmentCode], '*999')

;

SQL SELECT *

FROM somesqlservertable

where dat_data >= '$(vstart)' and dat_data <= '$(vend)'

;



filter in Sql

LOAD *

;

SQL SELECT *

FROM somesqlservertable

where dat_data >= '$(vstart)' and dat_data <= '$(vend)'

and departmentcode like '%999'

;

joeybird
Creator III
Creator III
Author

Hiya

A *** brill xx

thank you

Kind Regards

Joeybird