Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Where statement

Can anyone help.  I need a where statement in my script which only includes any rows with the following criteria :


All data for company 'ABCD' where the status is NOT in authorised status and the create date > 365 ago

The script below does not work.

Where Company = 'ABCD' and

(Status<>'Authorised' and CreateDate>=(Today()-365))

Thoughts anyone?

Please help

Thanks

Phil

7 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi Phil ,

Try

Where Company = 'ABCD' and Status<>'Authorised' and CreateDate>=Date((Today()-365))    Or

Where Company = 'ABCD' and Status<>'Authorised' and Num(CreateDate)>=(Today()-365)


Andrey

sunny_talwar

What you mentioned isn't working for you?

juan_patrick
Creator
Creator

hi,

Is case sensitive,check that or you can do this:

where upper(Status) <>'AUTHORISED'


BETTER:


WHERE

NOT MATCH(upper(Status), 'AUTHORISED')



the other thing is the format of the date field, but i think thats working.

Anonymous
Not applicable
Author

The above suggestions dont work.

My actual where statement works, but it excludes all authorised and shows all records which are less than 12 months old.

What I want is for it to show all records with an exception of the records less than 12 months old which still have a status 'authorisation'. 

i.e.  If the record is less than 12 months old then it still needs to show the authorised fields.

Does that make sense?

Anonymous
Not applicable
Author

each statement works on it's own, so it can't be a syntax error

sunny_talwar

May be this

Where (Company = 'ABCD' and Status<>'Authorised' and CreateDate >= Today()-365) or (Company = 'ABCD' and Status = 'Authorised' and CreateDate < Today()-365);

juan_patrick
Creator
Creator

Load *

from table

where

company = 'ABCD' and

(

  (createdate <= 365 and status <> 'authorised') or

  (createdate > 365)

);