Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trouble using Where Clause

I only want to see certain data from a specific field in a table.  I have tried using several where clauses, but all fields keep loading in.

Here is what I have in my script:

SQL Select UserDefined1

FROM dbo.tblIncidentUtilityCross

WHERE UserDefined1 = 'New Customer', 'Existing Customer', 'New Dealer', 'Existing Dealer';

Any help would be appreciated.

Thanks

9 Replies
jerem1234
Specialist II
Specialist II

Try:

SQL Select UserDefined1

FROM dbo.tblIncidentUtilityCross

WHERE UserDefined1 in ('New Customer', 'Existing Customer', 'New Dealer', 'Existing Dealer');

Hope this helps!

Not applicable
Author

I tried that and it still gave me all values in the field

jerem1234
Specialist II
Specialist II

hmm its working for me, do you have another table that just has the UserDefined1 field?

Not applicable
Author

yes that field it is in multiple tables

jerem1234
Specialist II
Specialist II

Try this and see if you get the correct values in your table:

TableTest:

SQL Select UserDefined1 as UserDefined1Test

FROM dbo.tblIncidentUtilityCross

WHERE UserDefined1 in ('New Customer', 'Existing Customer', 'New Dealer', 'Existing Dealer');


If you do, then your table is being automatically concatenated to another table that has all the values. I don't know what you are doing in your script, so I can only guess.

MarcoWedel

or

LOAD *

Where Match(UserDefined1,  'New Customer', 'Existing Customer', 'New Dealer', 'Existing Dealer');

SQL Select UserDefined1

FROM dbo.tblIncidentUtilityCross;

hope this helps

regards

Marco

Not applicable
Author

Thanks that worked.  really appreciate it

Not applicable
Author

Hi Toedtli,

               In case you are having a problem of tables getting concatenated due to same column names.

You can also use Qualify which names the fields as Tablename.FieldName making the fields unique preventing concatenation.

1. For all fields: QUALIFY *

2. For specific fields QUALIFY fieldname1, fieldname2

3. Use UNQUALIFY * or UNQUALIFY fieldname1, fieldname2 when you want to disable this functionality.

Thanks,

Shoubhik.

jyothish8807
Master II
Master II

Hi Toedtli,

Try using Match function in your script which works equivalent to IN in your SQL Script.

Load

*

where Match(UserDefined1,'New Customer', 'Existing Customer', 'New Dealer', 'Existing Dealer');

Hope it helps.

Regards

KC

Best Regards,
KC