Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exclude values in SQL query

So i have the below section in my script, as I am trying to exclude Firms with the name ICAP in. But my wildmatch function doesn't seem to work. Is wildmatch the best way of doing this?

SQL SELECT Id,

  AccountId,

  Firm__c

FROM Contact

WHERE AccountId != NULL AND WILDMATCH(Firm__c, '*ICAP*')=0;

I have also tried this, which also does not work

SQL SELECT Id,

  AccountId,

  Firm__c

FROM Contact

WHERE AccountId != NULL AND NOT WILDMATCH(Firm__c, '*ICAP*');

What am I doing wrong?

1 Solution

Accepted Solutions
Not applicable
Author

Figured it out, through trial and error

Firm__c != '*ICAP*'

thanks for your help anyway guys! It got me there in the end

View solution in original post

10 Replies
pokassov
Specialist
Specialist

Hello!

Wildmatch is QV's operator, not SQL.

Try this

load

     *

where wildmatch(...);

sql select ...;

swuehl
MVP
MVP

Try

SQL SELECT Id,

  AccountId,

  Firm__c

FROM Contact

WHERE AccountId != NULL Firm__c NOT LIKE '%ICAP%';

alexandros17
Partner - Champion III
Partner - Champion III

Wildmatch is a qlik function so you cannot use into a Select statement.

You could do

Load

...

Where WILDMATCH(Firm__c, '*ICAP*')=0;

Select

... (Your query)

otherwiseyou can use only SQL

doing:

SELECT Id,

  AccountId,

  Firm__c

FROM Contact

WHERE AccountId != NULL AND not Firm__c Like '%ICAP&';

let me know

Not applicable
Author

I am loading from Salesforce, so it needs an SQL statement.

The statement works absolutely fine without the wildmatch bit

PrashantSangle

Hi,

try

Firm_c not like '%ICAP%'

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
alexandros17
Partner - Champion III
Partner - Champion III

use this

SELECT Id,

  AccountId,

  Firm__c

FROM Contact

WHERE AccountId != NULL AND not Firm__c Like '%ICAP%'

Not applicable
Author

you missed the AND out, but it didn't work anyway

got this error

ERROR at Row:19:Column:40 unexpected token: LIKE

Not applicable
Author

What is the SQL equivalent?

Not applicable
Author

didn't work

ERROR at Row:19:Column:39 unexpected token: LIKE