Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
jelindbe
Partner - Contributor III
Partner - Contributor III

Strange results from where clause

I want to extract certain years and certain age groups.

This code works to extract the age groups (ages 0-5 years):

where Alder_1agr = '5 år' or Alder_1agr = '4 år' or Alder_1agr = '3 år' or Alder_1agr = '2 år' or Alder_1agr = '1 år' or Alder_1agr = '0 år';


And this code works to extract the years I want:

where INTAAR > 2014;


But when I combine like this:

where Alder_1agr = '5 år' or Alder_1agr = '4 år' or Alder_1agr = '3 år' or Alder_1agr = '2 år' or Alder_1agr = '1 år' or Alder_1agr = '0 år'

and INTAAR > 2014;

.....the result I get is an extraction of age groups but the extraction of years dos not work (I get all the years).

I cannot figure out why.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try adding some parentheses so the conditions are grouped together properly:

where (Alder_1agr = '5 år' or Alder_1agr = '4 år' or Alder_1agr = '3 år' or Alder_1agr = '2 år' or Alder_1agr = '1 år' or Alder_1agr = '0 år')

and INTAAR > 2014;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Try adding some parentheses so the conditions are grouped together properly:

where (Alder_1agr = '5 år' or Alder_1agr = '4 år' or Alder_1agr = '3 år' or Alder_1agr = '2 år' or Alder_1agr = '1 år' or Alder_1agr = '0 år')

and INTAAR > 2014;


talk is cheap, supply exceeds demand
jelindbe
Partner - Contributor III
Partner - Contributor III
Author

Thank you! (How silly of me.)