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

how to use and & or condition in Qlikview

HI  team,

I am new to qlik view tool ..in my daily my sql Query i will be using and & or condition

for example

sql: select * from table1

where (saleschannel = 'CORPORATE' AND (bookingsource='CORPORATE' OR bookingsource != 'ONLINE')


guys have any idea..how to use in the tool

1 Solution

Accepted Solutions
PrashantSangle

Hi,

You can try wildMatch() this way

if(WildMatch(TicketSalesChannel,'CORPORATE') and WildMatch(TicketBookingChannel,'CORPORATE'),'Agents',

  if(WildMatch(TicketSalesChannel,'WEBSERVICE','PAYMENTPARTNER'),'Partners')) as takecategorydeatils

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 🙂

View solution in original post

10 Replies
MK_QSL
MVP
MVP

In the script you can use the SQL statements?

Kindly explain where exactly you want to use the above?

alexandros17
Partner - Champion III
Partner - Champion III

you are missing a parenthesis:

select * from table1

where (saleschannel = 'CORPORATE' AND (bookingsource='CORPORATE' OR bookingsource != 'ONLINE'))

jsingh71
Partner - Specialist
Partner - Specialist

HI Kalyan,

In qlikview also we are using AND, OR operator only and for not equal to instead of != this QV supports <> symbol.

Hope this will solve your problem. Still if are facing any issue let us know.

Not applicable
Author

Dear Kalyan,

Please refer the attached qvw.

PrashantSangle

Hi,

If you are using in script level then do like this way,

select * from table1

where saleschannel = 'CORPORATE' AND (bookingsource='CORPORATE' OR bookingsource <> 'ONLINE')


Or


select * from table1

where (saleschannel = 'CORPORATE' AND (bookingsource='CORPORATE' OR bookingsource <> 'ONLINE'))


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 🙂
Not applicable
Author

Hi kalyan,

You Can Use same 'and' ,'Or' in qlikview same as SQL.

For Ex your stmt

Load * from table.qvd

where saleschannel = 'CORPORATE' and (bookingsource='CORPORATE' Or bookingsource <> 'ONLINE') ;

Hope it Helps

Regards,

Koti

Not applicable
Author

guys thanks for the help ..i have kept question in wrong way i think ..i am just sharing code


code Example :


Load *,

if(WildMatch(TicketSalesChannel,'CORPORATE'),'Agents',

  if(WildMatch(TicketSalesChannel,'WEBSERVICE','PAYMENTPARTNER'),'Partners',)) as takecategorydeatils

from temp_tickets.qvd

for the above script

i want to add one more condition like

load *

if(WildMatch(TicketSalesChannel,'CORPORATE' and TicketBookingChannel,'CORPORATE'),'Agents',

  if(WildMatch(TicketSalesChannel,'WEBSERVICE','PAYMENTPARTNER'),'Partners',)) as takecategorydeatils

from temp_tickets.qvd

is it possible

kalyan

Not applicable
Author

Please find the attachment

PrashantSangle

Hi,

You can try wildMatch() this way

if(WildMatch(TicketSalesChannel,'CORPORATE') and WildMatch(TicketBookingChannel,'CORPORATE'),'Agents',

  if(WildMatch(TicketSalesChannel,'WEBSERVICE','PAYMENTPARTNER'),'Partners')) as takecategorydeatils

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 🙂