Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

"where" statement

Hi Everyone

I have the following script:

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft;

I would like to include only values that are "AG", "AP" and "DC"

How would I have to script this?

Thank you very much for your help!

19 Replies
Not applicable
Author

Hi treseco

I am not sure i got what you were trying to do. Could you write the whole script?

Thank you for your help!

tresesco
MVP
MVP

I guess, there is a understanding gap. Could you explain expected output against a sample input?

Not applicable
Author

Here is what I would like to do:

I have the following script:

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft;

I would like to include only values that are "AG", "AP" and "DC"

The data I load from a pervasive database so the whole script looks like this:

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft;

SQL SELECT "job_nummer",

    jobnr,

    "datum_auftrag",

    Year ("datum_auftrag") as Jahr,

    Month ("datum_auftrag") as Monat,

    jobkategorie

FROM EASY.job where "datum_auftrag" is not null;

gandalfgray
Specialist II
Specialist II

Try

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft

where match(mid(job_nummer, 11,2),'AG', 'AP', 'DC');

SQL SELECT "job_nummer",

    jobnr,

    "datum_auftrag",

    Year ("datum_auftrag") as Jahr,

    Month ("datum_auftrag") as Monat,

    jobkategorie

FROM EASY.job where "datum_auftrag" is not null;

anbu1984
Master III
Master III

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft

Where Match(mid(job_nummer, 11,2), 'AG', 'AP' ,'DC');

SQL SELECT "job_nummer",

    jobnr,

    "datum_auftrag",

    Year ("datum_auftrag") as Jahr,

    Month ("datum_auftrag") as Monat,

    jobkategorie

FROM EASY.job where "datum_auftrag" is not null;

tresesco
MVP
MVP

You can filter it at the DB level like:

LOAD *,

mid(job_nummer, 11,2) as Gesellschaft;

SQL SELECT "job_nummer",

    jobnr,

    "datum_auftrag",

    Year ("datum_auftrag") as Jahr,

    Month ("datum_auftrag") as Monat,

    jobkategorie

FROM EASY.job where "datum_auftrag" is not null And "Job_number"  in ('AG', 'AP' ,'DC');

Not applicable
Author

AWESOME! Thank you anbu 

gandalfgray
Specialist II
Specialist II

And what's wrong with my answer?

I think it is fair to mark the first correct answer as correct.

Not applicable
Author

Sorry GandalfGray. I do not get your answer to work. I will try again. I definately appechiate your help...

Not applicable
Author

You are right, you entered the same code. My apologies...